uuidIndex.register
This commit is contained in:
parent
4cc367587d
commit
6cda84df66
|
@ -12,11 +12,20 @@
|
|||
uuidIndex
|
||||
*/
|
||||
|
||||
const uuidIndex = new Map();
|
||||
const bgReady = {};
|
||||
bgReady.styles = new Promise(r => (bgReady._resolveStyles = r));
|
||||
bgReady.all = new Promise(r => (bgReady._resolveAll = r));
|
||||
|
||||
const uuidIndex = Object.assign(new Map(), {
|
||||
custom: {},
|
||||
customize(obj, setter) {
|
||||
Object.defineProperty(uuidIndex.custom, obj.id, {
|
||||
get: () => obj,
|
||||
set: setter,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
function addAPI(methods) {
|
||||
for (const [key, val] of Object.entries(methods)) {
|
||||
const old = API[key];
|
||||
|
|
|
@ -73,10 +73,7 @@ const styleMan = (() => {
|
|||
_id: `${chrome.runtime.id}-${INJ_ORDER}`,
|
||||
_rev: 0,
|
||||
};
|
||||
uuidIndex.custom = Object.defineProperty({}, INJ_ORDER, {
|
||||
get: () => orderWrap,
|
||||
set: setOrder,
|
||||
});
|
||||
uuidIndex.customize(orderWrap, setOrder);
|
||||
/** @type {Promise|boolean} will be `true` to avoid wasting a microtask tick on each `await` */
|
||||
let ready = init();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user