-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
40 lines (33 loc) · 1.09 KB
/
index.html
File metadata and controls
40 lines (33 loc) · 1.09 KB
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
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Module Component</title>
</head>
<body>
<div data-component="example" data-color="red">
<span data-element="field">My Element</span>
<button type="button" data-action="change-color">Set Color</button>
</div>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="dest/monkey.js"></script>
<script>
MONKEY.ComponentWrapper( 'Example', function(Example) {
Example.fn.init = function() {
this.addEventListener();
};
Example.fn.addEventListener = function() {
this.addEvent( 'click', 'change-color' );
};
Example.fn.setBackground = function() {
this.elements.field.css( 'background', this.color );
};
Example.fn._onClickChangeColor = function() {
this.setBackground();
};
});
//start components in application
MONKEY.factory.create( MONKEY.vars.body );
</script>
</body>
</html>