workerboxjs
Version:
A secure sandbox to execute untrusted user JavaScript, in a web browser, without any risk to your own domain/site/page.
24 lines (18 loc) • 341 B
JavaScript
import generateUniqueId from './generateUniqueId.js';
function createCallbackStore () {
const store = {};
const add = fn => {
const id = generateUniqueId();
store[id] = fn;
return id;
};
const get = id => {
return store[id];
};
return {
store,
add,
get
};
}
export default createCallbackStore;