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
Shin-ichi Ueda
July 02, 2012
Technology
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AMD/RequireJS @2012.07.02
Shin-ichi Ueda
July 02, 2012
Other Decks in Technology
See All in Technology
巨大気象データと戦う ― サロゲートモデル学習を高速化する圧縮技術
gpuunite_official
0
170
Software Supply Chain Attackからクラウド環境を守るためにできること
lhazy
2
290
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
Flutter × BLE Centralを自前Pluginで実装する設計パターン - MethodChannel / EventChannelで作る双方向ブリッジの実践 / Building Custom Flutter BLE Central Plugins: Bidirectional Bridging with Method & Event Channels
bitkey
PRO
0
190
Android skills に学ぶ
kokiko
0
130
LLM Internals: 언어 모델의 계보와 알고리즘 진화 (2023~2026)
inureyes
PRO
1
800
35分でわかるEffective Platform Engineering
nwiizo
5
550
ハーレムエンジニアリング
kazuma777777
0
190
私がブラウザを自作したくなった理由
supurazako
1
270
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9.3k
関東Kaggler会発表資料
takoi
1
270
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
180
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.7k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
470
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
170
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
260
Docker and Python
trallard
47
4.1k
Visualization
eitanlees
152
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
For a Future-Friendly Web
brad_frost
183
10k
Design in an AI World
tapps
1
280
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.4k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
390
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݄༵