Talk at é¢è¥¿Nodeå¦å æ¢ ç°ãã£ã³ãã¹ 1æéç® https://nodejs.connpass.com/event/82614/
ãã®ä¸ãæåã®å¦ç¿ææãæ´çãããªãã¸ããªãä½ã£ãã®ã§ããã®ææã«ã¤ãã¦ã¾ã¨ãã¦ããã ä½ã£ããµã³ãã«ããã¸ã§ã¯ãã ããæ軽ã«æ¬²ãããã°ããã®ãªãã¸ããªã clone ãã¦ã»ããã taichi/js-boilerplatemaster ãã©ã³ãã«ã¯ããããã 㪠JavaScript éçºç°å¢ããµã³ãã«ã³ã¼ãä»ãã§å ¥ã£ã¦ããfrontend ãã©ã³ãã«ã¯ãReact/Redux/webpackãªã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ç¨ã®éçºç°å¢ãå ¥ã£ã¦ããããã©ã«ããã©ã³ãã«ãã¦ãã electron ãã©ã³ãã«ã¯ãfrontend ãã©ã³ãã®å 容ã«å ãã¦Electronã§ã¢ããªã±ã¼ã·ã§ã³ãéçºããããã®ç°å¢ãå ¥ã£ã¦ããã¯ããã«#æè¿ã® JavaScript ã«ã¤ãã¦#åã¯ä»äºã¨ã㦠JavaScript ãæ¸ãã¦ãã訳ã§ã¯ãªããã©ãããã®åå¹´ãããã®éã«ã¡ãã£ã¨ãããã¼ã«ãªãããã¤ãä½ã£ããã©ã¡ãã便å©
webpackã¨ã¯ ããããªãã¡ã¤ã«ãtranspileãã¦ES5ã®JavaScriptã«å¤æãã¦ãããã㤠AMDãCommonJSã®å½¢å¼ã§ãã¡ã¤ã«ããã¼ã(CommonJSãªãrequire)ããã¨ãtranspileãããã¡ã¤ã«ããã¼ããã¦ããã ã¯ã©ã¤ã¢ã³ãå´ã®jsã³ã¼ãã§ãrequireã使ç¨ãããã¨ãã§ãã assetã¨ãã¦ãã«ããã¦é å¸ããã¤ã¡ã¼ã¸ ã³ã¼ããå ±ç¨ã®å ´åãè¨å®ãå¤ãããã¨ã§ç´ ã®requireãå©ç¨ãããµã¼ãã¼ç¨ã³ã¼ãã¨ãwebpackãpolyfillããrequireãå©ç¨ããã¯ã©ã¤ã¢ã³ãã³ã¼ãã¨ãå¥ã ã«çæã§ãã å ¨ã¦ãJavaScriptã«ãªããç»åãCSSã ç»åã¯ãBase64ãFilePathãã« CSSã¯ãheadã«styleãæ¿å ¥ããjsã³ã¼ããã« ç¹å®ã®ãã¡ã¤ã«ãã©ã®ããã«transpileãããã¯pathãããã³ã°ã§ãã©ã°ã¤ã³å½¢å¼ã§è¨å®ãã
ã¯ããã« ç¸å¤ããããTODOã¢ããªãä½ããªãã React ã®åå¼·ããã¦ãã¾ãã JavaScript ã« lint ãã¼ã«ãããã®ãç¥ããã«ã³ã¼ãã£ã³ã°ãã¦ããã®ã§ãããESLint ã使ã£ã¦ã¿ã¦ä¾¿å©ã ã£ãã®ã§æé ãã¾ã¨ãã¦ããã¾ãã eslint.org ããã§ã ã»ãã³ãã³ã®ã¤ãå¿ã console.log æ®ããã¾ã¾ã ã£ãã ãªãã¦ãããã¨ã¨ã¯ãããã°ã§ãï¼ ç°å¢ OS X 10.10.5 ESLint 2.3.0 ESLintã®å°å ¥ npm ãã ESLint ãã¤ã³ã¹ãã¼ã«ãã¾ãã $ npm install --save-dev eslint $ node_modules/.bin/eslint -v v2.3.0 è¨å®ãã¡ã¤ã«ã®ä½ææ¹æ³ ESLint ã®æ大ã®é åã¯ãæ¤è¨¼é ç®ãèªç±ã«è¨å®åºæ¥ããã¨ã§ãã éã«ãæ¤è¨¼é ç®ãå¤ããã¦å°å ¥ã大å¤ã¨ãªã£ã¦ã¯å ãåãããã¾ããã å
æä½éã®ã³ã¹ãã§æè¿ããèãããæãã®jsãæ¸ãããæã®æ§æãããã¼ã£ã¨æ¸ãã¦ã¿ã æºåãããã® node/npm (æè¿ã¯rbenvã¯ãã¼ã³ã®nodenvãããæããæä½ã¯åã) webpack babel .babelrc .babelrcãè¨ç½®ãã¨ãã¨babelã®ããã©ã«ãè¨å®ãããã¤ã®ä¸èº«ã§æ¸ãæãã Reactã使ããªããªããpresetã®reactã¯ãããªã export defaultãããããã±ã¼ã¸ãimportããæã«.defaultã§å¼ãã®ã許ãããªããadd-module-exportsã¯ãããªã(å¾è¿°) Reactãã { "presets": [ "es2015", "stage-0", "react" ], "plugins": [ "add-module-exports" ] } ãããªã { "presets": [ "es2015", "stage-0"
ã¢ãã¼é¢æ°ã¨ã¯ åºæ¬æ§æ é常ã®ç¡åé¢æ°ã¨ã®éã thisã®æ±ãã«æ³¨æ jQueryã§ã³ã¼ã«ããã¯é¢æ°ã¨ãã¦ã¢ãã¼é¢æ°ã使ãå ´å ã¢ãã¼é¢æ°ã§å³æé¢æ° ã¾ã¨ã åèãªã³ã¯ ã¢ãã¼é¢æ°ã¨ã¯ ES2015ã®æ°æ§æã®ä¸ã¤ãã¢ãã¼é¢æ°ãã¨ã¯ãç¡åé¢æ°ã®çç¥è¨æ³ã§ããç¡åé¢æ°ã§ã¯ãªãããããããé¢æ°å®£è¨ãã«ã¯ä½¿ããã¨ãã§ãã¾ãããã¾ããå¾è¿°ãã¾ããç¡åé¢æ°ã¨ã¢ãã¼é¢æ°ã¨ã¯å®å ¨ã«ç価ã¨ããããã§ã¯ãªããããåãæ±ãã«ã¯ããã¤ãã®æ³¨æãå¿ è¦ã§ãã //å¾æ¥ã®é¢æ°å¼ var fn = function (x) {/* é¢æ°æ¬ä½ */}; //ä¸è¨ã®é¢æ°å¼ã®ç¡åé¢æ°é¨åï¼å³è¾ºï¼ãã¢ãã¼é¢æ°ã«ç½®ãæãããã®ã以ä¸ã§ãã var fn = (x) => {/* é¢æ°æ¬ä½ */}; //次ã®æ§ãªãé¢æ°å®£è¨ããã¢ãã¼é¢æ°ã«ç½®ãæãããã¨ã¯åºæ¥ã¾ããã function fn(x) {/* é¢æ°æ¬ä½ */} åºæ¬æ§æ
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()
ã©ãããã¾ãã¨ããï¼@0310lanï¼ã§ãã ã¿ãªããã¯ããJavaScriptã©ã¤ãã©ãªããæ´»ç¨ãã¦ããã§ããããï¼ Webãµã¤ãå¶ä½ã¯ãã¡ããã®ãã¨ããã¾ãã¾ãªWebã¢ããªããµã¼ãã¹ãªã©ãéçºããæã«ãå¤§å¹ ãªæéç縮ãã¯ãªãªãã£ãé£èºçã«ã¢ãããããã¨ãåºæ¥ãããã«ãªãã¾ãã ããã§ä»åã¯ãå½å å¤ã§äººæ°ãé«ãã¦èª°ã§ãç°¡åã«æ±ãããJavaScriptã©ã¤ãã©ãªããå³é¸ãã¦ãç´¹ä»ãããã¨æãã¾ãï¼ â å¤æ©è½ãªãåçã®ã£ã©ãªã¼ããçµã¿è¾¼ããã©ã¤ãã©ãªï¼ â1.Viewer.js è¤æ°ã®ç»åã表示ããéã«ããªã·ã£ã¬ãªãã®ã£ã©ãªã¼é¢¨ãã«å¤æãã¦ãããã©ã¤ãã©ãªã§ãã é¡ä¼¼ã®ã©ã¤ãã©ãªã¯ããã¤ãåå¨ãã¾ããããViewer.jsãã¯ä½¿ãæ¹ãé常ã«ã·ã³ãã«ã§æ±ããããã®ã«ãå¤æ©è½æ§ãåãã¦ããã¹ã°ã¬ã¢ãã¨ãªã£ã¦ãã¾ãã åºæ¬çãªä½¿ãæ¹ã¨ãã¦ã¯ãHTMLãã¡ã¤ã«ã«è¡¨ç¤ºããããç»åãããªã¹ãè¦ç´ ãã§æ
jQueryã使ã£ãã³ã¼ãã£ã³ã°ã§é¢æ°å®ç¾©ã ES6(Babel使ç¨)ã®ã¢ãã¼ãã¡ã³ã¯ã·ã§ã³ã§æ¸ãæãããåããªããªã£ãã®ã§ã åç´ã«é¢æ°å ã§ã®thisã®æå³ãå¤ããããæåãå¤ããã ã¢ãã¼é¢æ° - JavaScript | MDN $('#foo').on('click', function() { $(this).hide(); }); ã $('#foo').on('click', () => { $(this).hide(); }); ã«æ¸ãæããã¨åããªãã âå®éã«thisã表示ãã¦ã¿ãå ´åundefinedã«ãªã£ããã©ãããªãããªã®ãã windowã¨ããããªãã®ãã See the Pen Check 'this' behave at arrow function by Fumihiro Nakahara (@711fumi) on CodePen. ä¸å¿ã®è§£æ±ºæ¹æ³ ä½æ
ãããããåé¡ã«ç´é¢ããã®ã§ãã¡ã¢ãã¦ããã åé¡ æ¬¡ã®ããã«ãjQueryã§ã³ã¼ã«ããã¯é¢æ°ã«ã¢ãã¼é¢æ°ãç¨ããã¹ã¯ãªãããè¨è¿°ããã $("item > title").each(() => { let title = $(this).text(); console.log(title); }); ãã®ES6ã®æ§æããBabelã§ES5ã¸ãã©ã³ã¹ãã¤ã«ããã¨... $("item > title").each(function(idx) { var title = $(undefined).text(); console.log(title); }); ã¢ãã¼é¢æ°ã®å ã®thisãundefinedã«ãªã£ã¦ãã¾ãã åé¡ã¯ãã©ããããã©ã³ã¹ãã¤ã«åå¾ã®ãeaché¢æ°ã§ã®thisã®æ±ãã®éãã«ãããã®ã®ããã ã 以ä¸ãã·ã³ãã«ãªä¾ãèãã¦ã¿ãã var arr = [1]; $(arr).
ã©ãããã¾ãã¨ããï¼@0310lanï¼ã§ãã ä»åã¯ãJavaScriptã使ã£ã¦ãã°ã©ãããã£ã¼ããæãããï¼ãã¨ããããã¾ãã¾ãªãã¼ã¿ãå¯è¦åããããï¼ãã¨ãã人ã«ãªã¹ã¹ã¡ã®JSã©ã¤ãã©ãªããç´¹ä»ãããã¨æãã¾ãã ã¾ããããã«ä½¿ãå§ããããããã«ããããã ãªæ§æã®ããµã³ãã«ã³ã¼ãããåããã¦æ²è¼ãã¦ããã®ã§ãèªåã«åã£ãã©ã¤ãã©ãªã使ãåã£æããã«ãªãã°å¹¸ãã§ãã â Chart.js ãChart.jsã æè¿ãæ´»çºã«ãã¼ã¸ã§ã³ã¢ããããã¦ãããChart.jsãã¯ããã¹ã¦ã®ã°ã©ããèªåçã«ã¢ãã¡ã¼ã·ã§ã³è¡¨ç¤ºãããã¦ãã¼ã¯ãªä»æããæã£ã¦ãããã·ã³ãã«ã§ç解ããããè¨è¿°ãåºæ¥ãç¹ãé åã§ãã ã°ã©ãã®ç¨®é¡ã¯å°ãªããã®ã®ãã¢ãã³ãã©ã¦ã¶ï¼ã¬ã¹ãã³ã·ã対å¿ã§ããã¾ãã«ã¹ã¿ãã¤ãºããã«ãããã©ã«ããã®ã¾ã¾ã§ãæ軽ã«ä½¿ããã§ãããã ã åºæ¬ã®æ¸ãæ¹ ã ãchart.jsããã¡ã¤ã«ã¯ãå ¬å¼
JavaScript Plugin Architectureã¨ããJavaScriptã®ãã©ã°ã¤ã³è¨è¨ã«ã¤ãã¦ã®é»åæ¸ç±ãæ¸ãã¾ããã ãã®æ¸ç±ã¯JavaScriptã®ã©ã¤ãã©ãªããã¼ã«ã«ããããã©ã°ã¤ã³ã¢ã¼ããã¯ãã£ã«ã¤ãã¦è¦ã¦ããäºãç®çã¨ãããã®ã§ãã 以ä¸ã®å½¢å¼ã§èªããã¨ãã§ãã¾ãã Webç PDFå½¢å¼ ePubå½¢å¼ Mobiå½¢å¼ GitHubä¸ã«ã½ã¼ã¹ã³ã¼ããå ¬éããã¦ããã§ã®ã§ç´æ¥Markdownãã¡ã¤ã«ãèªããã¨ãã§ãã¾ãã Markdownããã¯Webçã®æ¹ãè¦ãããã®ã§ãã¡ãããªã¹ã¹ã¡ãã¾ãã Twitterã®ããã·ã¥ã¿ã°ã¯#js_plugin_book æ´æ°æ å ±ã¯RSSããªãªã¼ã¹ãã¼ãããè¦ããã¨ãã§ãã¾ãã v1.0.0 æåã«æ¸ãã¨æ±ºãããã©ã°ã¤ã³ã¢ã¼ããã¯ãã£ãæã£ãã®ã§1.0.0ã¨ãã¦ãªãªã¼ã¹ãã¾ããã JavaScript Promiseã®æ¬ã®æã¨åãããç¶
è¿½è¨ ææ°ã®ææ³ãåããã¦ã覧ãã ããã jinjor-labo.hatenablog.com Reactçéã§ã¯çµæ§åãããCSS in JSãã¨è¨ã£ã¦ãéã«è¨ãã¨ãCSSã¯ã¤ã±ã¦ãªãããJSã§ã¤ã³ã©ã¤ã³ã¹ã¿ã¤ã«ãæ¸ãã¦ãã¾ããã¨ãã話ããããï¼ã¡ããã¨ç¥ããã人ã¯ãã¡ãï¼ èªåãåã ããCSSã¯å¤æ°ã使ããªãã¨ãååã被ãã¨ã諸ã ã¤ã±ã¦ãªãã®ã¯åæãã¦ããã ãã©ããããJSã§æ¸ãã®ãè¯ããã¨è¨ãããããããæµç³ã«ãã¸ãã¯æ±ããããããï¼ãã¨ããCSSã®ä¾¿å©æ©è½ãæ¨ã¦ã¦å¹³æ°ãªã®ï¼ãã¨ãè²ã ã¨æççã ã£ããã ãã©ãï¼ï½ï¼ãææ¸ãã¦ã¿ããæ³å以ä¸ã«è¯ãã£ãã®ã§ææ³ãæ¸ããã¨ã«ããã ã¾ãä¸çªã«ä¸»å¼µãããé¨åãå ã«è¨ãã¨ãããã ï¼èª¤è§£ï¼JSã®ã³ã¼ããã¹ã¿ã¤ã«è¨è¿°ã§æ±ãã ï¼æ£è§£ï¼JSã®ã³ã¼ããã¹ã¿ã¤ã«è¨è¿°ãã解æ¾ããã åæ å®éã«æ¸ããã®ã¯JavaScriptã§ã¯ãªãElmãªã®ã§ä»¥ä¸ã¯å ¨ã¦
ãµã¤ãã¦ãºã®æ¡ç¨æ å ±ãã¼ã¸ãè¦ã¦ããã ãµã¤ãã¦ãº | æ¡ç¨æ å ±ï¼æ°åã»ãã£ãªã¢ï¼ ã¨ãã£ã¦ãåããã¨ãã§ã¯ãªãããã æ§æ ¼æªããã¨ãæã£ã¦ããã ããªãã ãã©ã Kintoneã®ã»ã¯ã·ã§ã³ã§ã¢ããªã£ã½ãã¢ã¤ã³ã³ãã¡ãå³ããå·¦ã¸ã¨æµãã¦ãããã ãã©ããããã¬ã¿ã¬ã¿ã¨ãã¦ããããããããã¦ããªããããããããããã ã¨ããããã§ãä½ãèµ·ãã£ã¦ããã®ãã調ã¹ã¦ã¿ãããã¨ãä½åãã«ããã¦æ¸ããã ãã®1 â ä½ãèµ·ãã£ã¦ããã®ã調ã¹ã ãã®2 â 調ã¹ãªããç´ããªããããããããã ãã®3 â ã¡ãã£ã¨ãããã¨ãä»ã®ãã©ã¦ã¶ã§ãããããããã ã¢ãã¡ã¼ã·ã§ã³ã®å®è£ ã調ã¹ã ãã¨ã®ãã¨ãèãã¦ãChrome DevToolsã使ãã ã¾ãã該å½ã®æµããã¢ã¤ã³ã³ã®ã¨ããã§å³ã¯ãªãã¯ãã¦inspectãããElementsããã«ã§ã<div class="icon"> ã¨ããè¦ç´ ããã¤ã©ã¤ãããããdiv
ããã«ã¡ã¯ã大éªéçºé¨ã®ããã¢ã§ãã ãã®éããµã¤ãã¦ãºã®æ¡ç¨æ å ±ãã¼ã¸ã®ã¢ãã¡ã¼ã·ã§ã³ã«ã¤ãã¦ã°ã¼ã°ã«ãããããã¼ã¨ãã¹ãã¼ãã®ç¢åããã«ããã³ããé ãã¾ããï¼ä»åã¯ãã®ã¢ãã¡ã¼ã·ã§ã³ãããããããããã¨ãã話ããããã¨æãã¾ãã çµç·¯ ï¼æé ãã¬ã³ããªã³ã°ããã©ã¼ãã³ã¹åå¼·ä¼ã社å ã§éå¬ãã¾ãããæ±äº¬éçºé¨ã®éå¹³ããã®è©±ããã¤ãã¿ã¼ã§åãããç¢åããã«ããã³ããé ãã¾ããã 社å ã§ã¬ã³ããªã³ã°ããã©ã¼ãã³ã¹åå¼·ä¼ãéå¬ä¸ãwill-changeã®å¹æ絶大ãªãã¢ã§ä¼å ´ãã©ãããããâ teppeis (@teppeis) April 15, 2016 https://t.co/t2Irugs85V ãçã¾ããã¢ããªã¯15ä¸ä»¶ãã®åãã¢ã¤ã³ã³ã®ã¨ãããå¥ã¬ã¤ã¤ã¼ã«ãªã£ã¦ããããåãããã«ãªãæ¥ãè¿ãã¨ãããã¨ã https://t.co/ki5VSvbumYâ Masataka Yakur
æè¿ã®Webãµã¤ãã§è¦ããã便å©ãªæ©è½ãé¢ç½ãä»æãã®ã³ã³ãã³ããæ°æã¡ããã¢ãã¡ã¼ã·ã§ã³ãä¼´ã£ãã¤ã³ã¿ã©ã¯ã·ã§ã³ãã¨ãã§ã¯ããå®è£ ã§ããCSSãã¹ã¯ãªãããjQueryã®ãã©ã°ã¤ã³ãç´¹ä»ãã¾ãã
ç§ãé¢æ°åããã°ã©ãã³ã°ã«ã¤ãã¦åº¦ã è³ã«ããããã«ãªã£ãã®ã¯ãæ°ã«æåããã§ããã§ãå½æã¯ããããä½ãªã®ãè¦å½ãã¤ãããåãªãããºã¯ã¼ãã ã¨æã£ã¦ãã¾ãããçããã®ä¸ã«ãããã®ãããªæ¹ã¯å¤ãã§ãããããã以æ¥ãç§ã¯é¢æ°åããã°ã©ãã³ã°ã«ã¤ãã¦æ·±ãå¦ã³ããã®è¨èãæ¥ã èãã¦ã¯ãããã®ã®å 容ãç解ãã¦ããªãåå¿è ã®æ¹ã®ããã«ãåããããã説æãããã¨æãç«ã¡ã¾ããã é¢æ°åããã°ã©ãã³ã°è¨èªã®è©±ã«ãªãã¨ãã Haskell 㨠Lisp 㯠ã©ã¡ããåªãã¦ããã®ã ãã¨ãã è°è« ã ç½ç±ãã å¾åã«ããã¾ããHaskellã¨Lispã¯ã©ã¡ããé¢æ°åè¨èªã§ãããå®éã«ã¯å¤§ããªéãããã£ã¦ãããããã«é·æã¨çæãããã¾ãããã®å ·ä½çãªå 容ã«ã¤ãã¦ã¯ããã®è¨äºãèªã¿çµããé ã«ã¯æ·±ãç解ãã¦ããã ããã¨æãã¾ãããã®2ã¤ã®è¨èªã«ã¯ãããããããæ´¾çããè¨èªãããã¾ãããã®ä¸ã§æããçãããè³ã«ããã
æè¿ãJavaScriptã«æ¹ãããçç±ã¯ãé¢æ°åè¨èªã®ç¹å¾´ãæã¤ã¨ããã«åå ããããããªæ°ããã¦ãã¾ãã Lispãå¾æã¨ãã¦ãã人ã¯ãLispè³ãªãèãæ¹ãããã¨ã®ãã¨ã§ãã èå³ã®æºæ³ã«åºä¼ãããã«ãLispè³ãè¦ãã¦ã¿ããã¨æãããèªã¿ãªãããJavaScriptã§Lispè³ãªFizzBuzz*1ãæ¸ãã¦ã¿ã¾ããã ãææ¬ (for-each print (map (lambda (x) (cond ((= (modulo x 15) 0) "FizzBuzz") ((= (modulo x 5) 0) "Buzz") ((= (modulo x 3) 0) "Fizz") (else x))) (iota 100 1))) ãããèªãã ãã§ã¯ãæ£ç´ä½ããã£ã¦ãããããã¾ããã次ã«ã解説ãèªã¿ãªããæ¸ãã¦ã¿ã¾ãã ã¾ãã¯ãªã¹ããä½ã ãã¨ãããã1ãã100ã¾ã§ã®ãªã¹ããä½ãã°è¯ã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}