JavaScript setTimeoutã§å®è¡ãããé¢æ°ã®ä¸ã§çºçããã¨ã©ã¼ã¯ãã»ããããé¨åã®try/catchã§è£è¶³ãããã¨ã¯ã§ãã¾ããã function throwError(){ throw new Error('ERROR'); } try{ setTimeout(throwError, 3000); } catch(e){ // ããã«ã¯å°éããªã alert(e); } MochiKit.Async.Deferredã使ãã¨ãã¨ã©ã¼ããã¯ã§ã¨ã©ã¼ãè£è¶³ã§ãã¾ãã callLater(3, throwError).addErrback(function(e){ alert(e); }); ã¨ã©ã¼ã®è£è¶³ä»¥å¤ã«ããDeferredã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ãã以ä¸ãè¡ãã¾ãã ãã£ã³ã»ã«(cancel)ç¶æ (fired)ã³ã¼ã«ããã¯ã®è¿½å (addCallback)ã¨ã©ã¼ããã¯ã®è¿½å
JavaScript MochiKit.Async.Deferredã¯ããç¾æç¹ã§ã¯ã¾ãå©ç¨ã§ããªãå¤ããæ±ãããã®ã¯ã©ã¹ã§ãã 以ä¸ã®ããã«ãã³ã¼ã«ããã¯ã並ã¹ãã¤ãã³ããçºç«ãããã¨ãåã ã®è¿ãå¤ã次ã®ã³ã¼ã«ããã¯ã¸æ¸¡ããå®è¡ããã¦ããã¾ãã function increment(value){ alert(value); return value+1; } var d = new Deferred(); d.addCallback(increment); // alert(1) d.addCallback(increment); // alert(2) d.addCallback(increment); // alert(3) d.callback(1); ãã®æãã³ã¼ã«ããã¯ã¯ä»¥ä¸ã®ããã«ãã§ã¼ã³ãå½¢æãã¦ãã¾ãã(æ¬å½ã¯ã¨ã©ã¼ããã¯ãåããã¦ä¸ã¤ã®ãã§ã¼ã³ãå½¢æãã¦ããã®ã§ããã
Deferredã«ç»é²ããé¢æ°ã次ã«å®è¡ãããã¾ã§ã®æéãè¨å®ã§ããããã«ãããã®ã§ããldrã®é 延æç»çãªãã¨ãå®ç¾ãã¦ã¿ããã£ãã®ã§ã以ä¸ã®ãããªæãã«ä½¿ãã¾ãã var id = new IntervalDeferred(); id.add_action(function() { Hoge.update_item(0); }, 500); id.add_action(function() { Hoge.update_item(1); }, 200); id.fire(); var id = new IntervalDeferred(true); id.add_action(function() { Hoge.update_item(0); }, 500); id.cancel(); id.add_action(function() { NeverHappend(); }, 200);
mochibotã¯Flash SWFãã¡ã¤ã«ã®ãã©ãã£ãã¯è¨æ¸¬ã¢ããªã§ããflvã®è»¢ééçãè¨æ¸¬åºæ¥ãããã§ã¢ã¯ã»ã¹ã«ã¦ã³ã¿ã®è±ªè¯çãã¨ãã£ãã¨ããã§ãããããæ£ç´ã«ããã¨ã¢ããªèªä½ã«ã¯ä»ã®ã¨ãããã¾ãèå³ãªãã¦ãFlash / JavaScript Integration Kitè¦ã¦ããé·ãã®mochikitå©ç¨ä¾ã¨ãã¦è¯ããããªæãã ã£ãã®ã§èªã¿å§ãã¦ãã¾ãããµã¼ãã¹ã®ãã¢ã¨ãã¦ã¢ã¯ã»ã¹åºæ¥ãç»é¢ã®ã³ã¼ãã§æ°ã«ãªãé¨åãæç²ãã¾ãã éãã£ãã·ã¥jsonèªã¿è¾¼ã¿ jsã©ã¤ãã©ãªã®ãã¼ã¸ã§ã³ä¸ãã£ãã¨ãã«ææ°çããã¦ã³ãã¼ããããããã«ãããã¯ããã¯ã¨åãè¦é ã§éãã£ãã·ã¥jsonããã¥ã¡ã³ããèªã¿è¾¼ããã¯ãã http://mochibot.com/include/js/my_common.js function loadUncachedJSONDoc(uri) { return lo
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}