github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/html/template/examplefiles_test.go (about) 1 // +build js 2 3 package template_test 4 5 import ( 6 "fmt" 7 ) 8 9 func ExampleTemplate_glob() { 10 fmt.Print("T0 invokes T1: (T1 invokes T2: (This is T2))") 11 // Output: 12 // T0 invokes T1: (T1 invokes T2: (This is T2)) 13 } 14 15 func ExampleTemplate_helpers() { 16 fmt.Print("Driver 1 calls T1: (T1 invokes T2: (This is T2))\nDriver 2 calls T2: (This is T2)") 17 // Output: 18 // Driver 1 calls T1: (T1 invokes T2: (This is T2)) 19 // Driver 2 calls T2: (This is T2) 20 } 21 22 func ExampleTemplate_share() { 23 fmt.Print("T0 (second version) invokes T1: (T1 invokes T2: (T2, version B))\nT0 (first version) invokes T1: (T1 invokes T2: (T2, version A))") 24 // Output: 25 // T0 (second version) invokes T1: (T1 invokes T2: (T2, version B)) 26 // T0 (first version) invokes T1: (T1 invokes T2: (T2, version A)) 27 } 28 29 func ExampleTemplate_parsefiles() { 30 fmt.Print("T1 invokes T2: (This is T2)") 31 // Output: 32 // T1 invokes T2: (This is T2) 33 }