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