MCPcopy
hub / github.com/darkreader/darkreader / add

Method add

tests/unit/utils/state-manager.tests.ts:12–24  ·  view source on GitHub ↗
(promises: Promise<void> | Array<Promise<void>>)

Source from the content-addressed store, hash-verified

10 }
11
12 add(promises: Promise<void> | Array<Promise<void>>) {
13 if (!Array.isArray(promises)) {
14 promises = [promises];
15 }
16 promises.forEach((promise) => {
17 if (this.promises.has(promise)) {
18 throw new Error('Already added');
19 }
20 this.promises.set(promise, 'pending');
21 promise.then(() => this.promises.set(promise, 'resolved'))
22 .catch(() => this.promises.set(promise, 'rejected'));
23 });
24 }
25
26 clear() {
27 this.promises.clear();

Callers 15

pushFunction · 0.80
parseColorSchemeConfigFunction · 0.80
addChangeListenerMethod · 0.80
validateArrayFunction · 0.80
fallback.tsFile · 0.80
hasBuiltInDarkThemeFunction · 0.80
detectUsingHintFunction · 0.80
createOrUpdateStyleFunction · 0.80
addDOMReadyListenerFunction · 0.80

Calls 2

hasMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected