Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AMD/RequireJS @2012.07.02
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Shin-ichi Ueda
July 02, 2012
Technology
1
150
AMD/RequireJS @2012.07.02
Shin-ichi Ueda
July 02, 2012
Tweet
Share
Other Decks in Technology
See All in Technology
Amazon Bedrock Knowledge Basesチャンキング解説!
aoinoguchi
0
120
AI駆動PjMの理想像 と現在地 -実践例を添えて-
masahiro_okamura
1
100
月間数億レコードのアクセスログ基盤を無停止・低コストでAWS移行せよ!アプリケーションエンジニアのSREチャレンジ💪
miyamu
0
830
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
0
330
入社1ヶ月でデータパイプライン講座を作った話
waiwai2111
1
260
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
210
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
190
Tebiki Engineering Team Deck
tebiki
0
24k
Deno・Bunの標準機能やElysiaJSを使ったWebSocketサーバー実装 / ラーメン屋を貸し切ってLT会! IoTLT 2026新年会
you
PRO
0
300
Cosmos World Foundation Model Platform for Physical AI
takmin
0
590
MCPでつなぐElasticsearchとLLM - 深夜の障害対応を楽にしたい / Bridging Elasticsearch and LLMs with MCP
sashimimochi
0
150
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.2k
[SF Ruby Conf 2025] Rails X
palkan
1
740
We Have a Design System, Now What?
morganepeng
54
8k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.2k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Visualization
eitanlees
150
17k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Utilizing Notion as your number one productivity tool
mfonobong
3
220
Practical Orchestrator
shlominoach
191
11k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Transcript
Module/Require.JS ϞδϡʔϧύλʔϯಋೖʹΑΔΤϨΨϯτͳ։ൃ 127݄2݄༵
Java Script ॻ͍ͯ·͔͢ʁ 127݄2݄༵
͜ Μ ͳ ͜ ͱ ʹ ͳ ͬ ͯ ͍
· ͤ Μ ͔ ʁ 127݄2݄༵
ϥΠϒϥϦͷڝ߹ 127݄2݄༵
ಡΈࠐΈࠈ <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="jquery.plugin1.js"></script> <script type="text/javascript" src="jquery.plugin2.js"></script>
<script type="text/javascript" src="jquery.plugin3.js"></script> <script type="text/javascript" src="jquery.plugin4.js"></script> <script type="text/javascript" src="jquery.plugin5.js"></script> <script type="text/javascript" src="jquery.plugin6.js"></script> <script type="text/javascript" src="jquery.plugin7.js"></script> <script type="text/javascript" src="jquery.plugin8.js"></script> <script type="text/javascript" src="jquery.plugin9.js"></script> <script type="text/javascript" src="jquery.plugin10.js"></script> <script type="text/javascript" src="jquery.plugin11.js"></script> <script type="text/javascript" src="jquery.plugin12.js"></script> <script type="text/javascript" src="jquery.plugin13.js"></script> <script type="text/javascript" src="jquery.plugin14.js"></script> ..... 127݄2݄༵
ͦΜͳوํͷͨΊͷ “Module” ὑ 127݄2݄༵
Module Paternͱʁ 127݄2݄༵
var myModule = function() { // Private Variable var privateVar
= ‘’; // Private Method var privateFunction = function() {}; return { // Public Variable publicVar: '', // Public Method publicFunction: function() {} } } (); // ಗ໊ؔ(͙͑͢ΔΑ͏ʹ͢Δ) http://yuiblog.com/blog/2007/06/12/module-pattern/ 127݄2݄༵
͔ΜͨΜͳྫ (ࢿྉԽ࣌ؒͳ͔ͬͨͷͰ…) 127݄2݄༵
ͦͨ͠ΒɺϞδϡʔϧ͕ ͍ͬͺ͍Ͱ͖ͪΌͬͨ 127݄2݄༵
ґଘؔͱ͔ ෳࡶ͗ͯ͢ϠόΠ A B C D E F ͝ʔΔ G
127݄2݄༵
͏Μ͟Γ 127݄2݄༵
ͦ͜ͰɺRequire.JS 127݄2݄༵
Require.JS 127݄2݄༵
Require.JS • Ϟδϡʔϧϩʔμʔ • ґଘؔνΣοΫ • ඇಉظಡΈࠐΈ • AMDͱ͍͏ઐ༻ܗࣜ 127݄2݄༵
AMD Asynchronous Module Definition 127݄2݄༵
Module Patern Λগ͔͑ͨ͠ͷ 127݄2݄༵
define([ID], [ґଘؔఆٛ], [FactoryMethod]); ϞδϡʔϧΛ࡞Δ (֤Ϟδϡʔϧʹهड़) Usage 127݄2݄༵
require([ґଘؔఆٛ], [FactoryMethod]); ϞδϡʔϧΛ͏ (ΞϓϦέʔγϣϯʹجຊ1ͭ) Usage 127݄2݄༵
͔ΜͨΜͳྫ (ͬͺΓࢿྉԽ࣌ؒͳ͔ͬͨͷͰ…) 127݄2݄༵
͜͜Ͱͷґଘؔ lib/jquery lib/ common blog/app main 127݄2݄༵
AMDʹରԠͯ͠ͳ͍ ϥΠϒϥϦ Ͳ͏͢Ε͍͍ͷʁ 127݄2݄༵
AMDԽ • ఘΊΔ • requirejsΑΓઌʹಡΉ • define()Ͱwrap • AMDରԠ൛Λ͏ 127݄2݄༵
·ͩΞϦ 127݄2݄༵
Ϟδϡʔϧ͕ ૿͑ͪΌͬͯ େมͰ͢ʼʻ 127݄2݄༵
r.js 127݄2݄༵
r.js • npm install -g requirejs • ґଘؔΛܭࢉͯ͠Ϟδϡʔϧ߹ମ • minified
• ϏϧυϓϩϑΝΠϧ(build.js) 127݄2݄༵
node r.js -o build.js Usage ͜Ε͚ͩʂ 127݄2݄༵
͔ΜͨΜͳྫ (ͬͺΓͬͺΓࢿྉԽ࣌ؒͳ͔ͬͨͷͰ…) 127݄2݄༵
One more thing... 127݄2݄༵
almond.js 127݄2݄༵
almond.js • require.jsͷػೳݶఆ൛ • ͍ܰ(1KB) • r.jsͰ࠷దԽͨ͠ޙͰ͏͜ͱ 127݄2݄༵
͓͠·͍ 127݄2݄༵