phiggins42 (owner)

Revisions

gist: 220653 Download_button fork
public
Public Clone URL: git://gist.github.com/220653.git
Embed All Files: show embed
midgit #
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
dojo.require("dojo.string");
(function(d){
 
var _eraseFrom = function(ar, handle, cb){
dojo.forEach(ar, function(item, index){
if(handle == item){
cb(item);
ar.splice(index, 0);
}
});
};
 
d.declare("jsconf._Midget", null, {
// summary: A miniature dijit._Widget
 
constructor: function(args, node){
d.mixin(this, args);
this._connects = [];
this._subscriptions = [];
this.domNode = d.byId(node) || d.create("div");
this.build();
this.postCreate();
},
 
build: function(){},
postCreate: function(){},
 
connect: function(node, event, cb){
return this._connects.push(d.connect(node, event, this, cb));
},
 
disconnect: function(handle){
_eraseFrom(this._connects, handle, d.disconnect);
},
 
subscribe: function(topic, cb){
return this._subscriptions.push(d.subscribe(topic, this, cb));
},
 
unsubscribe: function(handle){
_eraseFrom(this._subscriptions, handle, d.unsubscribe);
},
 
destroy: function(preserve){
!preserve && d.destroy(this.domNode);
dojo.forEach(this._connects, this.disconnect, this);
dojo.forEach(this._subscriptions, this.unsubscribe, this);
},
 
placeAt: function(ref, position){
if(ref && ref.addChild){
ref.addChild(this, position);
}else{
d.place(this.domNode, ref, position);
}
}
 
});
 
d.declare("jsconf._Tigit", jsconfig._Widget, {
// summary: A miniature templated widget mixin class
template:"",
build: function(){
this.domNode = d.place(d.string.substitute(this.template, this), this.domNode, "replace");
}
});
 
})(dojo);