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
68
69
70
71
72
73
74
75
76
77
|
define.class('$system/base/node',function(require){
var RpcHub = require('$system/rpc/rpchub')
var Render = require('./render')
this._atConstructor = function(){
}
this.atConstructor = function(){
this.composition = this
this._intervals = []
}
this.ondestroy = function(){
for(var key in this.hub){
prop = this.hub[key]
if(typeof prop == 'object'){
if(prop.destroy && typeof prop.destroy == 'function'){
prop.destroy()
}
renderer.destroy(prop)
}
}
for(var i = 0; i < this._intervals.length; i++){
clearInterval(this._intervals[i])
}
}
this.toString = function(){
var out = 'Teem RPC object:\n'
for(var key in this){
if(key in Node.prototype) continue
out += key +'\n'
}
return out
}
this.setInterval = function(cb, timeout){
var id = setInterval(cb, timeout)
this._intervals.push(id)
return id
}
this.clearInterval = function(id){
var i = teem._intervals.indexOf(id)
if(i != -1) teem._intervals.splice(i, 1)
clearInterval(id)
}
this.renderComposition = function(){
Render.process(this, undefined, undefined, false, true)
this.names = {}
for(var i = 0; i < this.children.length; i++){
var child = this.children[i]
if(!child.createRpcProxy) continue
var name = child.name || 'default'
this.rpc[name] = child.createRpcProxy(this.rpc)
this.names[name] = child
}
}
})
|