root / trunk / web / dojo / dojox / lang / async / topic.js
History | View | Annotate | Download (808 Bytes)
1 |
/*
|
---|---|
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
|
5 |
*/
|
6 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.lang.async.topic"]){ |
9 |
dojo._hasResource["dojox.lang.async.topic"]=true; |
10 |
dojo.provide("dojox.lang.async.topic");
|
11 |
(function(){
|
12 |
var d=dojo,_1=dojox.lang.async.topic;
|
13 |
_1.from=function(_2){ |
14 |
return function(){ |
15 |
var h,_3=function(){ |
16 |
if(h){
|
17 |
d.unsubscribe(h); |
18 |
h=null;
|
19 |
} |
20 |
},x=new d.Deferred(_3);
|
21 |
h=d.subscribe(_2,function(){
|
22 |
_3(); |
23 |
x.callback(arguments);
|
24 |
}); |
25 |
return x;
|
26 |
}; |
27 |
}; |
28 |
_1.failOn=function(_4){ |
29 |
return function(){ |
30 |
var h,_5=function(){ |
31 |
if(h){
|
32 |
d.unsubscribe(h); |
33 |
h=null;
|
34 |
} |
35 |
},x=new d.Deferred(_5);
|
36 |
h=d.subscribe(_4,function(_6){
|
37 |
_5(); |
38 |
x.errback(new Error(arguments)); |
39 |
}); |
40 |
return x;
|
41 |
}; |
42 |
}; |
43 |
})(); |
44 |
} |