Skip to content

Instantly share code, notes, and snippets.

@vegemite4me
vegemite4me / memoizeLocalStorage.js
Last active April 12, 2024 07:36 — forked from cpitt/memoizeLocalStorage.js
Memoize a function using local storage as it's cache
/**
* memoizes a function using localStorage as the cache
* @param {function|Promise} fn function or promise you wish to memoize
* @param {Object} [options] additional configuration
* @param {number} [options.ttl=0] time to live in seconds
* @param {Boolean} [options.backgroundRefresh=false] whether the cache should be refreshed asynchronously,
* Note: new results won't resolve until next execution
* @return {Promise} Promise object represents memoized result
*/
function memoizeLocalStorage(
@vegemite4me
vegemite4me / .treehouse
Created October 20, 2022 04:50 — forked from ErikGartner/.treehouse
dTree Demo
1.3.1