Original idea and code for idb-keyval taken from here: https://www.npmjs.com/package/idb-keyval
I just cannot stop myself from making it even smaller, so I made a port of the idb-keyval to CoffeeScript :)
npm install
coffee --compile idb-keyval.coffee
idbKeyval.set('hello', 'world');
idbKeyval.set('foo', 'bar');
Since this is IDB-backed, you can store anything structured-clonable (numbers, arrays, objects, dates, blobs etc).
All methods return promises:
idbKeyval.set('hello', 'world')
.then(() => console.log('It worked!'))
.catch(err => console.log('It failed!', err));
// logs: "world"
idbKeyval.get('hello').then(val => console.log(val));
// logs: ["hello", "foo"]
idbKeyval.keys().then(keys => console.log(keys));
idbKeyval.delete('hello');
idbKeyval.clear();
This is port of idb-keyval (https://github.com/jakearchibald/idb-keyval) to CoffeeScript!