Skip to content

Commit 95a3328

Browse files
Update hello-world.js
1 parent c4ca7d6 commit 95a3328

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
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+
}

0 commit comments

Comments
 (0)