data-cache.js

A Map sub-class backed by a persistant store

Tento skript by nemal byť nainštalovaný priamo. Je to knižnica pre ďalšie skripty, ktorú by mali používať cez meta príkaz // @require https://update.greatest.deepsurf.us/scripts/31448/206062/data-cachejs.js

Autor
spiralx
Verzia
1.0.0
Vytvorené
14.07.2017
Aktualizované
14.07.2017
Veľkosť
4,9 KB
Licencia
neuvedené

data-cache.js

Example: Quick tester cache

For playing with in DevTools.

c = ((key, data) => {
  function getter() { console.info('getter(): %o', data); return data }
  function setter(value) { console.info('setter(%o)', value); data = value }

  return new DataCache({ getter, setter, debug: true })
})('test', { name: 'bob', items: ['foo', 'bar'] })
Example: User Script
const cache = new DataCache({
  getter: GM_getValue,
  setter: GM_setValue,
  key: 'repos'
})

cache.set('favourites', [ 'json-schema-faker/json-schema-faker', 'angular/angular', 'jquery/jquery' ])