Modular JavaScript: FEL, Feb 2013

Modular JavaScript: FEL, Feb 2013

Aea964cf59c0c81fff752896f070cbbb?s=128

Jack Franklin

February 28, 2013
Tweet

Transcript

  1. 3.

    Who is this guy? Author of "Beginning jQuery" Blogger at

    javascriptplayground.com Developer for Kainos (JS & Ruby) Comp-Sci student at University of Bath
  2. 4.

    Book Giveaway! Tweet your most cringe-worthy, clean joke with the

    hashtag #feljoke I'll pick two winners once I'm done talking.
  3. 10.

    modules don't know about each other modules are independent modules

    don't talk to each other directly so they need some way of communicating
  4. 12.

    Modules have no knowledge of each other Modules publish events

    Modules subscribe to events Loosely coupled, more maintainable modules don't publish events to specific other modules, but just do it generally
  5. 14.

    The Module Pattern var APP = (function() { var _count

    = 0; var incrementCount = function() { _count++; } var getCount = function() { return _count; } return { incrementCount: incrementCount, getCount: getCount }; })(); _count is kept private can only be manipulated through incrementCount
  6. 15.
  7. 16.

    RequireJS Implements the AMD Spec define() modules require() them No

    more <script> tag rubbish Dynamic module loading Build tool
  8. 20.

    GruntJS Run tasks on your JS, including plugins for: -

    Concatenating - Minifying - RequireJS Build Tool - Sass / LESS - CoffeeScript - Handlebars / Jade / templating - QUnit / Jasmine / Mocha / testing
  9. 22.

    - one step at a time - split your JS

    up (in development) - use a tool (Grunt) for production JS - jQuery does Pub/Sub - initial hurdles outweighed by long-term gains