New webpack filter: byDisplayName (#474)
This commit is contained in:
parent
8a52189378
commit
291f38115c
1 changed files with 16 additions and 0 deletions
|
@ -50,6 +50,8 @@ export const filters = {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
byDisplayName: (name: string): FilterFn => m =>
|
||||||
|
m.constructor?.displayName === name
|
||||||
};
|
};
|
||||||
|
|
||||||
export const subscriptions = new Map<FilterFn, CallbackFn>();
|
export const subscriptions = new Map<FilterFn, CallbackFn>();
|
||||||
|
@ -326,6 +328,20 @@ export function findByCodeLazy(...code: string[]) {
|
||||||
return findLazy(filters.byCode(...code));
|
return findLazy(filters.byCode(...code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find a store by its displayName
|
||||||
|
*/
|
||||||
|
export function findByDisplayName(name: string) {
|
||||||
|
return find(filters.byDisplayName(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* findByDisplayName but lazy
|
||||||
|
*/
|
||||||
|
export function findByDisplayNameLazy(name: string) {
|
||||||
|
return findLazy(filters.byDisplayName(name));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for a module that matches the provided filter to be registered,
|
* Wait for a module that matches the provided filter to be registered,
|
||||||
* then call the callback with the module as the first argument
|
* then call the callback with the module as the first argument
|
||||||
|
|
Loading…
Reference in a new issue