data-cache.js

A Map sub-class backed by a persistant store

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/31448/206062/data-cachejs.js

作者
spiralx
版本
1.0.0
建立日期
2017-07-14
更新日期
2017-07-14
授權條款
未知

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' ])