Skip to content

Instantly share code, notes, and snippets.

View osadan's full-sized avatar

Ohad osadan

  • Israel
  • 17:28 (UTC -12:00)
  • LinkedIn in/osadan
View GitHub Profile
// overriding sync to use local storage when possible
sync : function(method, model, options){
var key, now, timestamp, refresh;
if(method === 'read' && this.constants.isStoredInLocalStorage) {
// only override sync if it is a fetch('read') request
key = this.getKey();
if(key) {
now = new Date().getTime();
timestamp = $storage.get(key + ":timestamp");
refresh = options.forceRefresh;