Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introducing Orbit.js

Introducing Orbit.js

Orbit is a new standalone library for coordinating access to data sources and keeping their contents synchronized.

Presented at the Boston Ember January 2014 meetup.

Dan Gebhardt

January 09, 2014
Tweet

More Decks by Dan Gebhardt

Other Decks in Programming

Transcript

  1. • Plain JavaScript • No dependencies (excepts a Promises/A+ library

    like RSVP) • Supports access to and transformation of any number of data sources... as long as they support the right interfaces. • Supports synchronous and asynchronous operations • Supports blocking and non-blocking operations
  2. • Requestable - for accessing and modifying data • Methods:

    find, add, update, patch, remove, link, unlink • Transformable - for transforming data • Methods: transform COMMON INTERFACES
  3. • MemorySource - an in-memory store • LocalStorageSource - an

    in-memory store that also persists to local storage • JSONAPISource - for JSON-API-compliant REST requests CORE SOURCES
  4. • Document is a complete implementation of RFC 6902 •

    Transformation methods: transform, add, remove, replace, move, copy and test. • Retrieval methods: retrieve TRANSFORMATIONS
  5. • Notifiers can emit messages to an array of subscribed

    listeners. • Evented interface can emit events and listen for responses. • Promises returned as responses can be resolved (first to resolve) or settled (once all resolved or failed). EVENTS
  6. • TransformConnector for connecting a source and target. • Two

    connectors are needed for bi-directional syncs. • Connectors can be blocking or not • RequestConnector for coordinating requests to data CONNECTORS
  7. + ?

  8. • Ember Data Orbit Adapter • Keep Orbit in the

    adapter layer • Works ok, but doesn't allow for bi-directional syncs INTEGRATION OPTIONS
  9. • Ember Data Support for Orbit Interfaces • Would provide

    the benefits of Orbit to Ember Data users • Would involve some breaking changes • Require use of Orbit-compliant adapters INTEGRATION OPTIONS
  10. • Ember/Orbit Integration without Ember Data • Would allow for

    the most flexibility in implementation • Would add one more option to a crowded field INTEGRATION OPTIONS
  11. SOURCES • Igor Terzic's Ember Data talk: http://www.infoq.com/presentations/ember-data • Alex

    Maccaw's post on Asynchronous UIs: http://blog.alexmaccaw.com/asynchronous-ui • Differential synchronization by Neil Fraser: https://neil.fraser.name/writing/sync/ • Promises A+ http://promises-aplus.github.io/promises-spec/
  12. AND FINALLY... • Orbit.js: https://github.com/cerebris/orbit.js • Orbit / Ember example:

    https://github.com/dgeb/orbit-ember-example • Slides: https://speakerdeck.com/dgeb