aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/plugins/hooks.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-03-10 11:10:16 +0100
committerChocobozzz <me@florianbigard.com>2023-03-14 14:17:58 +0100
commitf386bab02eff654694c85ccb826d80df91c4e471 (patch)
treef8ab1d38bb3e3f189ee42d06655f9710b6731532 /client/src/app/core/plugins/hooks.service.ts
parentb34563079a7a7f059ab251e9caab9df4e928b503 (diff)
downloadPeerTube-f386bab02eff654694c85ccb826d80df91c4e471.tar.gz
PeerTube-f386bab02eff654694c85ccb826d80df91c4e471.tar.zst
PeerTube-f386bab02eff654694c85ccb826d80df91c4e471.zip
Add ability for plugins to add metadata
Diffstat (limited to 'client/src/app/core/plugins/hooks.service.ts')
-rw-r--r--client/src/app/core/plugins/hooks.service.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts
index d9fef8389..978316ec2 100644
--- a/client/src/app/core/plugins/hooks.service.ts
+++ b/client/src/app/core/plugins/hooks.service.ts
@@ -48,6 +48,15 @@ export class HooksService {
48 return this.pluginService.runHook(hookResultName, result, params) 48 return this.pluginService.runHook(hookResultName, result, params)
49 } 49 }
50 50
51 async wrapFunResult <P, R, H extends ClientFilterHookName>
52 (fun: RawFunction<P, R>, params: P, scope: PluginClientScope, hookResultName: H) {
53 await this.pluginService.ensurePluginsAreLoaded(scope)
54
55 const result = fun(params)
56
57 return this.pluginService.runHook(hookResultName, result, params)
58 }
59
51 runAction<T, U extends ClientActionHookName> (hookName: U, scope: PluginClientScope, params?: T) { 60 runAction<T, U extends ClientActionHookName> (hookName: U, scope: PluginClientScope, params?: T) {
52 // Use setTimeout to give priority to Angular change detector 61 // Use setTimeout to give priority to Angular change detector
53 setTimeout(() => { 62 setTimeout(() => {