-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.mjs
31 lines (27 loc) · 850 Bytes
/
index.mjs
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
/**
* Initial entry point. Referenced from index.html.
*/
import Nameplate from "./Nameplate/index.mjs";
/**
* Included here as an example of event subscription, this listener simply
* reports that the name in the Nameplate UI element has been clicked.
*
* @param {Object} event - Parameters extended from underlying mouseclick event
*/
function onNameClicked(event) {
console.log("name clicked:", event);
}
/**
* "Entry point" in which a Nameplace is instantiated, configured, and finally
* rendered. See "README.md" for more details.
*
* @param {Object} event - Basic on-window-load event
*/
function onWindowLoad(event) {
new Nameplate()
.set("name", "Bob")
.set("age", 42)
.on("NAME_CLICKED", onNameClicked)
.render(window.document.body);
}
window.addEventListener("load", onWindowLoad);