-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
60 lines (46 loc) · 1.29 KB
/
example.js
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
function Baz (list) {
this.print = function () {
var content = document.getElementById("content")
list.each(function (node) {
content.appendChild(document.createTextNode(node))
content.appendChild(document.createTextNode("\n"))
})
}
}
function Bar (message) {
this.message = message
this.feature = function () {
window.alert("And you can also: \f".format("click"))
}
}
function Foo (bar) {
this.hello = function () {
window.alert(bar.message)
bar.feature()
return false
}
}
var hello = document.getElementById("hello")
hello.onclick = function () {
var foo = context.load("foo")
foo.hello()
}
var list = document.getElementById("list")
list.onclick = function () {
var baz = context.load("baz")
baz.print()
}
function Greeter () {
this.hello = function (observer, ctx) {
var fragment = document.createElement("nothing")
observer.notify(fragment)
}
this.goodbye = function (observer, ctx) {
/* Traverse up to the dialog root node, and remove it:
* TODO A way to remove children from the controller xml.
*/
var dialog = ctx.element.parentNode
dialog.parentNode.removeChild(dialog)
return false
}
}