Skip to content

Commit adeb7d9

Browse files
Create hello-world.js
1 parent 91480bf commit adeb7d9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// packages/tel-frontend/src/components/hello-world/hello-world.js
2+
3+
/**
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.
8+
*/
9+
10+
function HelloWorld($module) {
11+
this.$module = $module;
12+
}
13+
14+
HelloWorld.prototype.init = function () {
15+
if (!this.$module) {
16+
return;
17+
}
18+
19+
// Example behaviour: toggle a highlight class on click
20+
this.$module.addEventListener('click', () => {
21+
this.$module.classList.toggle('hello-world--highlight');
22+
});
23+
};
24+
25+
export default HelloWorld;

0 commit comments

Comments
 (0)