-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgetters.html
More file actions
40 lines (35 loc) · 906 Bytes
/
Copy pathgetters.html
File metadata and controls
40 lines (35 loc) · 906 Bytes
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>
<head>
<link href="prism.css" rel="stylesheet" />
<link href="index.css" rel="stylesheet" />
<script src="../../dist/supermodels.js"></script>
<script src="examples.js"></script>
<script class="code">
var modelSchema = {
line1: String,
line2: String,
get fullAddress() {
return this.line1 + ' ' + this.line2;
},
anotherFullAddress: {
__get: function() {
return this.line1 + ' ' + this.line2;
}
}
};
var Model = supermodels(modelSchema);
var model = new Model();
model.on('change', logEvent)
model.line1 = 'foo';
model.line2 = 'bar';
console.log(model.fullAddress);
console.log(model.anotherFullAddress);
</script>
</head>
<body>
<pre class="language-javascript"><code class="language-javascript"></code></pre>
<script src="index.js"></script>
<script src="prism.js"></script>
</body>
</html>