]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/OpenAjax.js
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
8 if(!window
["OpenAjax"]){
9 OpenAjax
=new function(){
14 var _2
="org.openajax.hub.";
17 h
.implementer
="http://openajax.org";
23 h
.registerLibrary=function(_3
,_4
,_5
,_6
){
24 _1
[_3
]={prefix
:_3
,namespaceURI
:_4
,version
:_5
,extraData
:_6
};
25 this.publish(_2
+"registerLibrary",_1
[_3
]);
27 h
.unregisterLibrary=function(_7
){
28 this.publish(_2
+"unregisterLibrary",_1
[_7
]);
31 h
._subscriptions
={c
:{},s
:[]};
35 h
.subscribe=function(_8
,_9
,_a
,_b
,_c
){
39 var _d
=_8
+"."+this._subIndex
;
40 var _e
={scope
:_a
,cb
:_9
,fcb
:_c
,data
:_b
,sid
:this._subIndex
++,hdl
:_d
};
42 this._subscribe(this._subscriptions
,_f
,0,_e
);
45 h
.publish=function(_10
,_11
){
46 var _12
=_10
.split(".");
48 this._publish(this._subscriptions
,_12
,0,_10
,_11
);
50 if((this._cleanup
.length
>0)&&(this._pubDepth
==0)){
51 for(var i
=0;i
<this._cleanup
.length
;i
++){
52 this.unsubscribe(this._cleanup
[i
].hdl
);
54 delete (this._cleanup
);
58 h
.unsubscribe=function(sub
){
59 var _13
=sub
.split(".");
61 this._unsubscribe(this._subscriptions
,_13
,0,sid
);
63 h
._subscribe=function(_14
,_15
,_16
,sub
){
68 if(typeof _14
.c
=="undefined"){
71 if(typeof _14
.c
[_17
]=="undefined"){
72 _14
.c
[_17
]={c
:{},s
:[]};
73 this._subscribe(_14
.c
[_17
],_15
,_16
+1,sub
);
75 this._subscribe(_14
.c
[_17
],_15
,_16
+1,sub
);
79 h
._publish=function(_18
,_19
,_1a
,_1b
,msg
){
80 if(typeof _18
!="undefined"){
85 this._publish(_18
.c
[_19
[_1a
]],_19
,_1a
+1,_1b
,msg
);
86 this._publish(_18
.c
["*"],_19
,_1a
+1,_1b
,msg
);
89 if(typeof _1c
!="undefined"){
92 for(var i
=0;i
<max
;i
++){
98 if(typeof cb
=="string"){
101 if(typeof fcb
=="string"){
104 if((!fcb
)||(fcb
.call(sc
,_1b
,msg
,d
))){
105 cb
.call(sc
,_1b
,msg
,d
);
112 h
._unsubscribe=function(_1e
,_1f
,_20
,sid
){
113 if(typeof _1e
!="undefined"){
115 var _21
=_1e
.c
[_1f
[_20
]];
116 this._unsubscribe(_21
,_1f
,_20
+1,sid
);
121 delete _1e
.c
[_1f
[_20
]];
127 for(var i
=0;i
<max
;i
++){
129 if(this._pubDepth
>0){
131 this._cleanup
.push(_22
[i
]);
142 for(var lib
in OpenAjax
.hub
.libraries
){
143 delete OpenAjax
.hub
.libraries
[lib
];
145 OpenAjax
.hub
.registerLibrary("OpenAjax","http://openajax.org/hub","0.6",{});
146 delete OpenAjax
._subscriptions
;
147 OpenAjax
._subscriptions
={c
:{},s
:[]};
148 delete OpenAjax
._cleanup
;
149 OpenAjax
._cleanup
=[];
150 OpenAjax
._subIndex
=0;
151 OpenAjax
._pubDepth
=0;
154 OpenAjax
.hub
.registerLibrary("OpenAjax","http://openajax.org/hub","0.6",{});