package templ import ( "crypto/sha256" "encoding/hex" "html" ) // JSUnsafeFuncCall calls arbitrary JavaScript in the js parameter. // // Use of this function presents a security risk - the JavaScript must come // from a trusted source, because it will be included as-is in the output. func JSUnsafeFuncCall[T ~string](js T) ComponentScript { sum := sha256.Sum256([]byte(js)) return ComponentScript{ Name: "jsUnsafeFuncCall_" + hex.EncodeToString(sum[:]), // Function is empty because the body of the function is defined elsewhere, // e.g. in a