Class enchant.Deferred
				非同期処理を扱うためのクラス.
jsdeferredのAPIを模倣している.
jQuery.Deferredとの互換性はない.
See: 
http://cho45.stfuawsc.com/jsdeferred/
			
- Defined in: enchant.js
 
| Constructor Attributes | Constructor Name and Description | 
|---|---|
Method Summary
| Method Attributes | Method Name and Description | 
|---|---|
| 
										 call(arg)
										 
										値を伝播させる. 
									 | 
								|
| 
										 error(func)
										 
										エラー処理を追加する. 
									 | 
								|
| 
										 fail(arg)
										 
										エラーを伝播させる. 
									 | 
								|
| 
										 next(func)
										 
										後続の処理を追加する. 
									 | 
								|
| <static> | 
										 enchant.Deferred.next(func)
										 
										タイマーで起動するDeferredオブジェクトを生成する. 
									 | 
								
| <static> | 
										 enchant.Deferred.parallel(arg)
										 
										複数のDeferredオブジェクトを待つDeferredオブジェクトを生成する. 
									 | 
								
Class Detail
						enchant.Deferred()
					
					
					enchant.Deferred
    .next(function() {
        return 42;
    })
    .next(function(n) {
        console.log(n); // 42
    })
    .next(function() {
        return core.load('img.png'); // wait loading
    })
    .next(function() {
        var img = core.assets['img.png'];
        console.log(img instanceof enchant.Surface); // true
        throw new Error('!!!');
    })
    .next(function() {
        // skip
    })
    .error(function(err) {
         console.log(err.message); // !!!
    });
						
					
				
					
					
					
				Method Detail
- 
								call(arg)値を伝播させる.
- Parameters:
 - {*} arg
 - 次の処理に渡す値.
 
 - 
								error(func)エラー処理を追加する.
- Parameters:
 - {Function} func
 - 追加するエラー処理.
 
 - 
								fail(arg)エラーを伝播させる.
- Parameters:
 - {*} arg
 - エラーとして伝播させる値.
 
 - 
								next(func)後続の処理を追加する.
- Parameters:
 - {Function} func
 - 追加する処理.
 
 - 
								
								
								タイマーで起動するDeferredオブジェクトを生成する.
- Parameters:
 - {Function} func
 
- Returns:
 - {enchant.Deferred} 生成されたDeferredオブジェクト.
 
 - 
								
								
								複数のDeferredオブジェクトを待つDeferredオブジェクトを生成する.
// array enchant.Deferred .parallel([ enchant.Deferred.next(function() { return 24; }), enchant.Deferred.next(function() { return 42; }) ]) .next(function(arg) { console.log(arg); // [ 24, 42 ] }); // object enchant.Deferred .parallel({ foo: enchant.Deferred.next(function() { return 24; }), bar: enchant.Deferred.next(function() { return 42; }) }) .next(function(arg) { console.log(arg.foo); // 24 console.log(arg.bar); // 42 });- Parameters:
 - {Object|enchant.Deferred[]} arg
 
- Returns:
 - {enchant.Deferred} 生成されたDeferredオブジェクト.