Swarm is built around its concise four-method interface that expresses the core function of the library: synchronizing distributed object replicas. The interface is essentially a combination of two well recognized conventions, namely get/set and on/off method pairs, also available as getField/setField and addListener/removeListener calls respectively.
var obj = swarmPeer.on(id, callbackFn); // also addListener() obj.set('field',value); obj.getField()===obj.get('field')===obj.field; obj.on('field', fieldCallbackFn); obj.off('field', fieldCallbackFn); swarmPeer.off(id, callbackFn); // also removeListener()
The author has defined an addressing protocol that uses tokens to describe various aspects of an event and object. For more details, see Swarm: specifying events.
- Reset mixins:
reset(), normalize(), and
- Helpers: Shortcuts for working with
display, fonts, images and high pixel ratio images
- Vendor prefixes
- Easings and gradients
Dmitri has also included Mocha/PhantomJS tests for checking the generated output and visualising it.
Developing an AngularJS Edge
The book is being sold through Gumroad for $14.95, reduced from $19.95. The author notes that it is also available through Amazon and Safari Books Online.