-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotifySplices.html
47 lines (42 loc) · 1.12 KB
/
notifySplices.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
<!doctype html>
<html>
<head>
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../polymer/polymer.html">
</head>
<body>
<dom-bind id="arrays">
<template>
<ul class="people">
<template is="dom-repeat" items="{{organization.people}}">
<li>
<span>{{item}}</span>
</li>
</template>
</ul>
</template>
</dom-bind>
<script>
var model = {
name: "Juicy",
people: [
"Alice",
"Bob"
]
};
var domBind = document.getElementById("arrays");
domBind.organization = model;
setTimeout(function(){
var removed = model.people[0];
model.people[0] = "Anna";
domBind.notifySplices('organization.people', {
index: 0,
removed: removed,
addedCount: 1,
object: model.people,
type: 'splice'
});
});
</script>
</body>
</html>