-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathevents.html
37 lines (30 loc) · 834 Bytes
/
events.html
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
32
33
34
35
36
37
<!DOCTYPE html>
<html>
<head>
<title>Events</title>
<meta charset="utf-8">
</head>
<body>
<template data-tagname="say-hello">
<button onclick="sayHello(name)">click me</button>
</template>
<say-hello></say-hello>
<script src="../build/magery-compiler.min.js"></script>
<script src="../build/magery-runtime.min.js"></script>
<script>
var components = MageryCompiler.compile('template');
var target = document.querySelector('say-hello');
var data = {
name: 'testing'
};
// handlers for template
var handlers = {
sayHello: function (name) {
alert('Hello, ' + name + '!');
}
};
// events are bound on first patch
components['say-hello'](target, data, handlers);
</script>
</body>
</html>