ORGANIZE: Modules that deal with DOM manipulation. Usually take a single element. Should not touch anything outside of that element. Monday, September 16, 13
ORGANIZE: This directory contains everything necessary for Require.JS to load templates. When we switch to browserify, it will be going away. Monday, September 16, 13
segment) { if(err) { return ready(err) } return ready(null, segment.criteria) } } STANDARDIZE: You should always delegate the error to your caller’s callback! Monday, September 16, 13
ee.once('eventname', function(item) { // fired on only // the *first* “eventname” }) ee.emit('eventname', <anything>) STANDARDIZE: Monday, September 16, 13
it into a new *type* // -- a function applied over time. var template = require('path/to/html') // for instance, templates take // Object -> String template.stream('context') STANDARDIZE: Monday, September 16, 13
(or other streams) // and produce a stream of distinct // application states var os = new ObjectState os.listen( $('[name=input]').stream() , 'data' // event to listen for , ['attr'] // attribute name to set ) os.pipe(template.stream('context')) STANDARDIZE: Monday, September 16, 13
Segment” is a good example. •It happens once and either succeeds or fails •“Delete XYZ” is implemented as a callback-accepting function. Monday, September 16, 13