mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleanup and fix activate-entity
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
c264d5f1e2
commit
87babc8f2c
10 files changed
+56
-79
No files matched your search
@@ -23,6 +23,7 @@
|
||||
import type { CatalogCategory, CatalogEntity } from "../../common/catalog";
|
||||
import { catalogEntityRegistry as registry } from "../../renderer/api/catalog-entity-registry";
|
||||
import type { CatalogEntityOnBeforeRun } from "../../renderer/api/catalog-entity-registry";
|
||||
import type { Disposer } from "../../common/utils";
|
||||
export { catalogCategoryRegistry as catalogCategories } from "../../common/catalog/catalog-category-registry";
|
||||
|
||||
export class CatalogEntityRegistry {
|
||||
@@ -50,21 +51,14 @@ export class CatalogEntityRegistry {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a onBeforeRun hook to a catalog entity.
|
||||
* Add a onRun hook to a catalog entity. If `onBeforeRun` was previously added then it will not be added again
|
||||
* @param catalogEntityUid The uid of the catalog entity
|
||||
* @param onBeforeRun The function that should return a boolean if the onBeforeRun of catalog entity should be triggered.
|
||||
* @param onBeforeRun The function that should return a boolean if the onRun of catalog entity should be triggered.
|
||||
* @returns A function to remove that hook
|
||||
*/
|
||||
addOnBeforeRun(entity: CatalogEntity, onBeforeRun: CatalogEntityOnBeforeRun) {
|
||||
addOnBeforeRun(entity: CatalogEntity, onBeforeRun: CatalogEntityOnBeforeRun): Disposer {
|
||||
return registry.addOnBeforeRun(entity, onBeforeRun);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one catalog entity onBeforeRun by catalog entity uid
|
||||
*/
|
||||
onBeforeRun(entity: CatalogEntity): Promise<boolean> {
|
||||
return registry.onBeforeRun(entity);
|
||||
}
|
||||
}
|
||||
|
||||
export const catalogEntities = new CatalogEntityRegistry();
|
||||
Reference in new issue
Block a user