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:

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Ready to get started?