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