Help us understand the problem. What is going on with this article?
ããï¼ï¼ï¼å¹´ã®æ©ã¿ã§æè¿ã¯ã£ããããã£ã¦ãããã ãã©ã俺ãã¤ã®ãããããã©ããã£ã¦åå¼·ãã¦ããã®ãããããªããªã£ãã ITç³»ã®ä»äºã ãããæ°ããã½ããã¦ã§ã¢ã¨ãæè¡ã¨ãåå¼·ãã¦ãã¹ã¿ã¼ãããã£ã¦æã£ã¦ãããã ãã©ã空ãæéã«åå¼·ãã¦ãããã£ããé ã«å ¥ã£ã¦ããªãã®ããã ä»äºã¯å¹¸ãã«ãããã¾ã§ãã©ãã¯ãããªãã®ãããããã£ã¦å¢ç°ã«æç´ããã°ãããæéãããããæ®æ¥ããã¾ã«ããããããä»äºã®ã¹ãã¬ã¹ã§ã©ãã£ã¦è©±ãããªãã ä¸çªå¤§ããã®ã¯çµå©ãã¦åä¾ã§ãã¦èªç±ãªæéãæ¸ã£ããã¨ãªãã ãããã©ãã§ããã以åããåå¼·ããããã§ããªããªã£ãã®ã åèæ¸ã¨ããã¥ã¼ããªã¢ã«åç»ã¨ãã«æ°åä¸åãããè²»ããã¦ãããã©ãããã®ï¼å²ãæºè¶³ã«èªãã¦ãªãã ã¨ã«ããåå¼·ãã¦ä½ãæé·ããã£ã¦å®æãããï¼ï¼å¹´ããããæã¦ã¦ãªãããåå¼·ãããã¨ã¸ã®ã¢ãããå ¨ç¶ããããªãã ä½ãããªãããããªããããã»ãããã·ã ããã¨ãã¥ã¼
ãã®ããã¹ã㯠JavaScript ã®ã³ã¼ã«ããã¯å°çã«ç²ããã²ã¨ã®ããã®ã³ã¼ã«ããã¯é§éè¡æåæ¸ã§ãã対象èªè 㯠JavaScriptéå段ãããã®äººã§ãããã®ããã¹ããèªãã¨ã以ä¸ã®ããããã®æ段ã«ãããéåæå¦çå¶å¾¡ã®ä»çµã¿ãå©ç¹ããã³æ¬ ç¹ããããããã«ãªãããããã¾ããã ã³ã¼ã«ããã¯å°ç jQuery.Deferred async.js Concurrent.Thread generators co fibers Web Workers (â»ãªãããé²æã®å·¨äººãã®ä¸é¨ãã¿ãã¬ãå«ã¾ããã®ã§æ³¨æãã¦ãã ãã) ããã¯ãä½æ 人ã¯ã³ã¼ã«ããã¯ããã®ããã¨ãã話ã§ããããï¼ éåæå¦çã£ã¦é¢åã§ããããJavaScriptã§ã¯ãããã ã³ã¼ã«ããã¯å°ç ã¨ãããã¤ã«ãã°ãã°é¥ããã¡ã§ãããã¨ãã°ãAjax ã§ãµãã¤ã®ãã¡ã¤ã« hoge.txt 㨠piyo.txt ãæã£ã¦ãã¦ãããã
ã³ã¼ã«ããã¯å°çã解æ¶ããPromiseãã¿ã¼ã³ Promiseã¯éåæå¦çã®ãã¶ã¤ã³ãã¿ã¼ã³ã®ä¸ã¤ã§ããéåæå¦çé¢æ°ã®æ»ãå¤ã¨ãã¦ãå¦çã®éä¸ããæå³ãããªãã¸ã§ã¯ããè¿ãäºã§ããããã¨ããã«æãå±ãããã«ãã¾ããã¡ãªã¿ã«è¨èªã«ãã£ã¦ã¯Futureã¨å¼ã°ãããã¨ãããã¾ããï¼åè: future - Wikipediaï¼ è¨èªã«ãã£ã¦ä½ãå©ç¹ã«ãªããã¯å¾®å¦ã«ç°ãªãã¾ãããJavaScriptã§ã¯ã³ã¼ã«ããã¯å°çãææ¢ã§ããäºã大ããã§ãããã JavaScriptã§ããè¦ãããéåæå¦çã¯ãå¦ççµæãã³ã¼ã«ããã¯é¢æ°ã§åãããã¿ã¼ã³ã§ãããæ¨æºAPIã§ãé »ç¹ã«ç¨ãããã¦ãã¾ãã
ã¯ããã« JavaScriptã¯å¦ä½ã«ãã¦Async/Awaitãç²å¾ããã®ã - ããããã¡ æè¡é¨å± â»äºåã«âã®è¨äºã¯èªã¾ãªãã¦ã大ä¸å¤«ã§ã ã¨ããè¨äºãã以åã«å人ããã°ã®æ¹ã«æ¸ããã®ã§ãããç§ãä»å¹´ããã¯Qiitaå§ããã®ã§ããã®è¨äºããªãã¡ã¤ã³ãã¦å度æ¸ãã¦ã¿ããã¨æãã¾ãã ã¾ãããã®è¨äºã§ã¯âã®è¨äºã§ã¯æ¸ããããªãã£ã話ãããã¤ãå¢ããã¦ãã¾ãã ä¾ãã°ãä¸å®åæ°å®è¡ãããPromiseã®è©±ã ã¨ããéåæå¦çã«ãããä¾å¤å¦çå¨ãã®é¢åããã話ã ã¨ãã ããããã¡ãã£ã¨ã ãé«åº¦ãªè©±ãæ··ãã¤ã¥ãååæ¸ãããã®ãããã¯ãªãªãã£ãä¸ããã®ãç®æ¨ã«ãã¾ããããã§ã¯ããã¾ãã 第ä¸ç« ãï½äººé¡ã¯setTimeoutãæ¡ç¨ãã¾ããï½ å¤ä»£ã®JavaScriptã§ã以ä¸ã®ãããªå¦çããããå ´åãã©ããã¦ããã§ããããã ãã©ã¦ã¶æ´æ°ç´å¾ã«ãaãã表示ãããã®2ç§å¾ã«ãbãã表示ããæ´ã«ãã®1
ã¯ããã« JavaScriptã¯éåæå¦çã¨ã®éãã§ãã 人é¡ãéåæå¦çãåãããã«ãPromiseãasync-awaitã¨ããæçµå µå¨ãçã¿åºãã¦ãåçã«ã¯ãªã¼ã³ã§å¹³åãªä¸çãçã¾ããã¨ãã話ã¯ä»¥åãã¾ãã => (ããããã¦ï¼ JavaScriptã¯å¦ä½ã«ãã¦Async/Awaitãç²å¾ããã®ã Qiitaç) ãããããï¼ï¼ï¼ çããçãã®ã§ããï¼ï¼ï¼ï¼ï¼ 人é¡ãè¦ããç¶ããéåæå¦çãããããªç°¡åã«å®å ¨ã«åããããããªãã®ã§ããã éåæå¦çã®æ¬å½ã«ã¤ãã¤æ·±æ·µãããããä¾å¤å¦çãã§ãã ã¿ãªããã¯Promiseã§éçºãã¦ãã¦ã ããªããéä¸ã¾ã§ãã¾ãè¡ã£ã¦ããã ãã©æ°ã¥ãããä¾å¤ãå¤å´ã«é£ã°ãªããªã£ãâ¦ãªãã§ã â¦ã ãå©ãã¦ï¼Promiseã«catchæ¸ãã¦ãã®ã«ä½æ ãä¾å¤ãcatchåºæ¥ãªãã®ï¼ï¼ï¼ã ã¨ããçµé¨ã¯ãªãã§ãããããç§ã¯ä½åº¦ãããã¾ãã ãã®è¨äºã§ã¯ãå ·ä½çã«ä½
ECMAScript 2015ï¼ECMAScript 6ï¼ã§æ°ãã«è¿½å ãããPromiseã«ã¤ãã¦ããã®æ¦è¦ãå ¨2åã«æ¸¡ã£ã¦ç´¹ä»ãã¾ãã ã²ã¨ã¤ãã¤å¦çãããJavaScript ã¾ããPromiseã«ã¤ãã¦è§£èª¬ããåã«ãåºç¤çãªãã¨ã§ã¯ããã¾ãããJavaScriptã®ã³ã¼ããã©ã®ããã«JavaScriptã¨ã³ã¸ã³ã«å¦çããããã«ã¤ãã¦ã軽ã解説ãã¦ããã¾ããããä¾ãã°ä»¥ä¸ã®æ§ãªã³ã¼ãããã£ãã¨ãã¾ãã var result1 = 1 + 2; // 3 var result2 = result1 + 100; // 103 /* functionããæºå */ var doSomething1 = function() { document.getElementById('price').value = result2; }; var doSomething2 = function()
Redux ã®ä¸æº Fluxã®å®è£ ã§ããReduxã®ä¸æºç¹ã®ãã¡ã®ï¼ã¤ã¨ãã¦ãReducerã®æ±ããããããã¡ããReducerã®èãæ¹ã¨ããã«ããStoreã®ç¶æ 管çãããã³combineReducersã«ããç¶æ ã®åå²çµ±æ²»ã«ã¤ãã¦ã¯ã¾ãããã®ã ããã©ããReducerã«ã¯åæçãªç¶æ å¤åããæ±ããªãï¼æ±ããªãï¼ã¨ããå¶ç´ããããå¾ã¦ãã¦å®éã®ã¢ããªã§ã¯ã¢ãã¯ã§åæå¦çã§è¡ã£ã¦ãããã¨ã§ããã¤ã®éã«ãéåæã®å¦çã¨ãªã£ãããããã¨ãããããã®å ´åReducerã§ä¸æããã£ã¦ããã¨ã§ãAction Creatorã®æ¹ã«ç§»åããªãããããªããªã£ããããã Action Creatorsã§ã¯ç¾å¨ã®Stateæ å ±ãè¦ãã®ã«ã¯getState()ã¨ãããªãStateããªã¼å ¨ä½ã«ã¢ã¯ã»ã¹ãããã¨ã«ãªããReducerã§ã¯ãã¾ãã§ãã¦ããåå²çµ±æ²»ãããã§ã¯å³ãããªãããªãã¨ãMiddlewareã§å·¥å¤«
ååã¯ãã¼ã¯ã½ã¦ã«ã®ãã©ã ã(frampt)ãããFLux Minimum ãªãããããããã ãªããTwitterã§è²ã è¨ã£ã¦ãã naoyaããã«ã¾ã¨ããããã®ã§ãããã«åã®èãã詳ããæ¸ãã¦ããã mizchi ã® Redux è - Togetterã¾ã¨ã ããããã£ãã㨠åºæ¬çãªã¢ã¤ãã¢ã¯ãstateãpushããæ¹å¼(setStateã¿ãããª)ã ã¨éåæéã§åç §ããã¨ãã®å¤ããºã¬ã¦éåæã®çµããé çªæ¬¡ç¬¬ã§ã¯ç¶æ ã®é·ç§»ã¹ããããå£ãã¦ãã¾ãå¯è½æ§ããããã ãã©ãåã®stateãã¨ã£ã¦æ¬¡ã®stateãè¿ãéåæããã¥ã¼ã«ä¸¦ã¹ã¦é ã«å®è¡ãããã¨ã§ããã©ã³ã¶ã¯ã·ã§ã³ã¿ãããªãã®ãä¿è¨¼ãããã¨ãã§ããã ãããã¨ãããã®ã 軽é(pubsubã¤ã³ã¿ã¼ãã§ã¼ã¹ã¯EventEmitterãã®ã¾ã¾) è¤æ°ã®ç¶æ æ´æ°é¢æ°ã®å¾ ã¡åãã reduxã§æããä¸æºã®è§£æ¶ TypeScriptãã¬ã³ããªã¼
åæ ããã§æ¸ãã®ã¯ããã¾ã§å人çãªæè¦ã§ãã react, reduxã¯ã©ã¡ãã使ãæ¹æ¬¡ç¬¬ã§ãã¬ã¼ã ã¯ã¼ã¯ã£ã½ãã使ãããããã ã®ãã¼ã«ã¨ãã¦ã使ãããã ããreact, reduxã使ã£ãããã³ãã¢ã¼ããã¯ãã£ã¯ãããã§ããã£ã¦ããã¨æãã ããã¯ãã®ãã¡ã®ä¸ã¤ãææ¡ãããã®ã§ãã ã¨ã¯ããç¹å¥ãªå®è£ æ¹å¼ãç·¨ã¿åºããããã§ã¯å ¨ç¶ãªãã¦ããããï¼å¨ãã¦åºæ»ããããããã çµè« éåæå¦çãã³ã³ãã(ã¾ãã¯ããã§ä½¿ãã¢ã¸ã¥ã¼ã«)ã«æ¸ãã ãã ä»ã¯ãéåæå¦çãããããã®redux middlewareã使ã£ã¦ãªãã§ãã éå»è¨äº(react, reduxå¨ãã®ããã±ã¼ã¸é¸å®ã¨KPT[2016-05-27ç¾å¨])ã«ã¦ããã®è¾ºã«ã¤ãã¦ããªãããããã¨è¨ã£ã¦ãããã©ãä»ã¯thunkãpromiseãsagaã使ã£ã¦ããªãããã®å®è£ ãåãã·ã³ãã«ã§æ°ã«å ¥ã£ã¦ãã®ã§ç´¹ä»ãã¾ãã ã©ãããã®ã red
çµå±jQuery.Deferredã®ä½ãå¬ããã®ãåãããªããã¨ãã人åãã®å°è©± ä¸å¹´ã»ã©åã« JavaScript - jQuery.Deferredã使ã£ã¦æ¥½ããéåæçæ´»ãéãæ¹æ³ - Qiita [ãã¼ã¿] ã¨ããè¨äºãæ¸ãã¾ããã ã§ãä¸å¹´çµã£ã¦ããµã¨ãããã£ã¨åãããããjQuery.Deferredã®ä¾¿å©ãã説æã§ããããããªãããã¨æãç«ã£ã¦ãããã£ã¨æ¸ãã¦ã¿ã¾ããã å°è©±ã¨è¨ãã«ã¯ã¡ãã£ã¨é·ããã©ã -- jQuery.Deferredã使ãã¨å¬ããã®ã¯ãjQuery.Deferredã®ä»æ§ãæºããé¨åå士ãç°¡åã«çµã¿åããããã¨ãå¯è½ã ããã§ããä¸ã«ã¯å¦çãæ¸ãä¸ããã¨ãã§ããã¨ãã³ã¼ã«ããã¯ã®ãã¹ããé²ããã®ãããã¨ãè¨ã人ããã¾ãããå人çã«ãã£ã¡ã®ã»ãããã£ã½ã©éè¦ã ã¨æãã¾ãã ä¾ãããªãã¬ã´ãããã¯ã§ããã¬ã´ãããã¯ã¯ãã®å¸ã¨å¹ãæã£ã¦ããããã¯ãèªç±ã«çµã¿å
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}