Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / lang / async / timeout.js @ 12

History | View | Annotate | Download (785 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.timeout"]){
9
dojo._hasResource["dojox.lang.async.timeout"]=true;
10
dojo.provide("dojox.lang.async.timeout");
11
(function(){
12
var d=dojo,_1=dojox.lang.async.timeout;
13
_1.from=function(ms){
14
return function(){
15
var h,_2=function(){
16
if(h){
17
clearTimeout(h);
18
h=null;
19
}
20
},x=new d.Deferred(_2);
21
h=setTimeout(function(){
22
_2();
23
x.callback(ms);
24
},ms);
25
return x;
26
};
27
};
28
_1.failOn=function(ms){
29
return function(){
30
var h,_3=function(){
31
if(h){
32
clearTimeout(h);
33
h=null;
34
}
35
},x=new d.Deferred(_3);
36
h=setTimeout(function(){
37
_3();
38
x.errback(ms);
39
},ms);
40
return x;
41
};
42
};
43
})();
44
}