File tree Expand file tree Collapse file tree 1 file changed +13
-17
lines changed
packages/tel-frontend/src/tel/components/hello-world Expand file tree Collapse file tree 1 file changed +13
-17
lines changed Original file line number Diff line number Diff line change 11// packages/tel-frontend/src/components/hello-world/hello-world.js
22
33/**
4- * Hello World component JS
5- * This is where you add interactive behaviour for your component.
6- *
7- * Example: Highlight the component when it is clicked.
4+ * HelloWorld component
5+ * Example: Highlight the component when clicked
86 */
97
10- function HelloWorld ( $module ) {
11- this . $module = $module ;
12- }
13-
14- HelloWorld . prototype . init = function ( ) {
15- if ( ! this . $module ) {
16- return ;
8+ export default class HelloWorld {
9+ constructor ( $module ) {
10+ this . $module = $module ;
1711 }
1812
19- // Example behaviour: toggle a highlight class on click
20- this . $module . addEventListener ( 'click' , ( ) => {
21- this . $module . classList . toggle ( 'hello-world--highlight' ) ;
22- } ) ;
23- } ;
13+ init ( ) {
14+ if ( ! this . $module ) return ;
2415
25- export default HelloWorld ;
16+ // Example behaviour: toggle highlight class on click
17+ this . $module . addEventListener ( 'click' , ( ) => {
18+ this . $module . classList . toggle ( 'hello-world--highlight' ) ;
19+ } ) ;
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments