PhoneGap Day! James Burke on RequireJS and Phonegap

James Burke - works at Mozilla @jrburke

Why webapps? They deploy everywhere!

Phonegap, B2G/Firefox OS, wavysandbox/install helps get your code on a device.

Volo, cool CLI javascript package manager.

Require.js, AMD modules

The Great Sadness
(you are the linker, browser only, disparate automation)
Normal

links.
indirect dependencies, wordier, async APIs

AMD
direct references to dependencies, simpler APIs for your modules
Special text plugin to load template resources.
With a template loader plugin, it does the compile for you.
Makes it easy to switch out jquery for zepto.
CommonJS sugar.
Creates cleaner html.
"The fastest code is the code you don't have to load."
CommonJS AMD loaders, standard format leads to choices.
requireJS, curl, Dojo, inject, Isjs

AMD - Build
Dependency handling.
In newest webkit, the browser won't do the JavaScript parse until the function is called, super smart!

AMD with phonegap
loader plugin for env
Reusable components, one www codebase
almond, or other dynamic load

Demo code
slides

Filed under:

Ready to get started?