Change onBeforeRun API (#3981)

Co-authored-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Juho HeikkaandSebastian Malton authored and GitHub committed 2021-10-07 12:43:50 -04:00
1 parent 58f7bcb38d
commit 724b9450a6
4 files changed
+82 -59

No files matched your search

+7 -5
View File
@@ -51,13 +51,15 @@ export class CatalogEntityRegistry {
}
/**
* Add a onBeforeRun 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 onRun of catalog entity should be triggered.
* Add a onBeforeRun hook to a catalog entities. If `onBeforeRun` was previously
* added then it will not be added again.
* @param onBeforeRun The function to be called with a `CatalogRunEvent`
* event target will be the catalog entity. onBeforeRun hook can call event.preventDefault()
* to stop run sequence
* @returns A function to remove that hook
*/
addOnBeforeRun(entity: CatalogEntity, onBeforeRun: CatalogEntityOnBeforeRun): Disposer {
return registry.addOnBeforeRun(entity, onBeforeRun);
addOnBeforeRun(onBeforeRun: CatalogEntityOnBeforeRun): Disposer {
return registry.addOnBeforeRun(onBeforeRun);
}
}