DataCache - Simple storage wrapper

Allows JSON data to be persisted easily by user scripts

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://greasyfork.org/scripts/10443-datacache-simple-storage-wrapper/code/DataCache%20-%20Simple%20storage%20wrapper.js?version=56962

Author
spiralx
Ratings
0 0 0
Version
0.0.1.20150615033807
Created
Updated
License
N/A
Applies to
All sites

Author's Description

Automates storing data as a JSON object. Example:

var cache = new DataCache('linked-urls');

cache.setValue('moo', 'http://google.com');

var moo = cache.getValue('moo', 'DEFAULT');

// --------------------------------------------------------------------------

GM_registerMenuCommand('Edit cache', function() {
  cache.edit();
}, 'p');

Requires both GM_getValue and GM_setValue permissions to be granted to any user script that requires it.