diff options
author | Chocobozzz <me@florianbigard.com> | 2023-03-10 11:10:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-03-10 15:45:52 +0100 |
commit | 4899138ec5995075c3681ccbd9f6b163fb915991 (patch) | |
tree | 285973833829de6c20a0aeb95142a07e839db29f /client/src/app/core/plugins | |
parent | 085aba61c35ad63155a46453dff7752840e82146 (diff) | |
download | PeerTube-4899138ec5995075c3681ccbd9f6b163fb915991.tar.gz PeerTube-4899138ec5995075c3681ccbd9f6b163fb915991.tar.zst PeerTube-4899138ec5995075c3681ccbd9f6b163fb915991.zip |
Add ability for plugins to add metadata
Diffstat (limited to 'client/src/app/core/plugins')
-rw-r--r-- | client/src/app/core/plugins/hooks.service.ts | 9 |
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 29db75d89..f325605e9 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(() => { |