-
Notifications
You must be signed in to change notification settings - Fork 53
/
test.html
62 lines (49 loc) · 1.17 KB
/
test.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html>
<head>
<title>array component</title>
<link rel="stylesheet" href="../build/build.css">
</head>
<body>
<h1>array component</h1>
<script src="../build/build.js" type="text/javascript"></script>
<script type="text/javascript">
var array = require('array'),
arr = array([1, 2, 3]);
console.log(arr.length);
arr.on('add', function(val) {
console.log('adding', val);
})
arr.on('remove', function(val) {
console.log('removed', val);
})
arr.on('pop', function(val) {
console.log('popping', val);
});
arr.on('shift', function(val) {
console.log('shifted', val);
})
arr.on('reverse', function(arr) {
console.log(arr);
})
arr.push('hi', 'hello');
arr.pop();
arr.pop();
arr.pop();
arr.unshift('lol', 'wahoo!')
arr.shift();
console.log(arr);
arr.splice(1, 2, 'hi')
console.log(arr);
arr.reverse();
var arr2 = array([1, 2]);
arr2.on('add', function(val) {
console.log('arr2: added', val);
});
arr2.on('remove', function(val) {
console.log('arr2: removed', val);
})
arr2.push();
arr2.pop();
</script>
</body>
</html>