lazyorm.js
JavaScript library that maps local objects to WebSQL/localStorage and remote REST endpoints, loading from memory first, then local DB, then the API, with lazy or double-callback modes. Built against the droplet.la API.
- BPM
- 138
- GRADE
- B
- LEVEL
- 4
- RELEASES
- 0
- YEARS
- 2013–2013
Published On April Second
Same pattern as the scroll plugin a year earlier: write it, sleep on it, push it the next morning. April 2, 2013, lazyorm.js: retrieve remote database objects and store them locally, lazily.
It checks three places in order: memory, then WebSQL, then the REST endpoint. You declare an object type by extending LazyOrm and registering it in $Cache with an id field, a remote resource name and a local one. Then $O.User('devin').load(callback) and you don't have to care where the data came from. It only needs jQuery. The server is set once at init, and in the example that server is api.droplet.la, since I was building the library and droplet at the same time.
It used WebSQL, which was later dropped from browsers, and it has an AngularJS note about checking the scope phase before applying.