init.js 472 B

123456789101112131415
  1. export const commands = {};
  2. export const addPublicCommands = obj => Object.assign(commands, obj);
  3. /** Commands that can be used only by an extension page i.e. not by a content script */
  4. export const addOwnCommands = obj => {
  5. for (const key in obj) {
  6. (commands[key] = obj[key]).isOwn = true;
  7. }
  8. };
  9. export let resolveInit;
  10. export let init = new Promise(r => {
  11. resolveInit = () => Promise.all(init.deps).then(r);
  12. });
  13. init.deps = [];
  14. init.then(() => (init = null));