This repository has been archived by the owner on Mar 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex2.html
67 lines (61 loc) · 1.78 KB
/
index2.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
63
64
65
66
67
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<title>Custom Element Demo</title>
<!-- Importing Polyfill -->
<script src="bower_components/platform/platform.js"></script>
<!-- Importing Custom Elemenent -->
<link rel="import" href="bower_components/brick-storage-indexeddb/dist/brick-storage-indexeddb.html">
<link rel="import" href="dist/brick-listview.local.html">
<style>
html, body {
height: 100%;
margin: 0;
}
#list {
flex: 1;
}
#main {
display: flex;
flex-direction: column;
height: 100%;
}
</style>
</head>
<body>
<div id="main">
<nav>
<button id="addone">Add 1 Item</button>
<button id="addten">Add 10 Items</button>
</nav>
<brick-listview id="list" label="label" image="image" detail="created"></brick-listview>
</div>
<script>
window.addEventListener('WebComponentsReady', function () {
window.list = document.querySelector('#list');
document.querySelector('#addone').addEventListener('click', function () {
addTodo();
list.render();
});
document.querySelector('#addten').addEventListener('click', function () {
for (var i=0; i<10; i++) {
addTodo(i);
}
list.render();
});
window.store = [];
list.data = store;
});
function addTodo(offset) {
store.push({
label: ((Math.random() * 1e6) | 0).toString(16),
image: 'http://placehold.it/80x80',
created: Date.now() + (offset || 0),
done: false
});
}
</script>
</body>
</html>