-
-
Notifications
You must be signed in to change notification settings - Fork 240
/
template_templ.go
66 lines (60 loc) · 2.22 KB
/
template_templ.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Code generated by templ - DO NOT EDIT.
package testscriptinline
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
func withParameters(a string, b string, c int) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_withParameters_1056`,
Function: `function __templ_withParameters_1056(a, b, c){console.log(a, b, c);
}`,
Call: templ.SafeScript(`__templ_withParameters_1056`, a, b, c),
CallInline: templ.SafeScriptInline(`__templ_withParameters_1056`, a, b, c),
}
}
func withoutParameters() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_withoutParameters_6bbf`,
Function: `function __templ_withoutParameters_6bbf(){alert("hello");
}`,
Call: templ.SafeScript(`__templ_withoutParameters_6bbf`),
CallInline: templ.SafeScriptInline(`__templ_withoutParameters_6bbf`),
}
}
func InlineJavascript(a string) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = withoutParameters().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = withParameters(a, "test", 123).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = withoutParameters().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = withParameters(a, "test", 123).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if !templ_7745c5c3_IsBuffer {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
}
return templ_7745c5c3_Err
})
}