Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Framasoft
PeerTube
PeerTube
Commits
2e5dd0be
Verified
Commit
2e5dd0be
authored
Jan 24, 2023
by
Chocobozzz
Browse files
Handle hook with Promise as result
parent
b1d8261c
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/root-helpers/plugins-manager.ts
View file @
2e5dd0be
...
...
@@ -105,11 +105,16 @@ class PluginsManager {
}
}
async
runHook
<
T
>
(
hookName
:
ClientHookName
,
result
?:
T
,
params
?:
any
)
{
if
(
!
this
.
hooks
[
hookName
])
return
result
async
runHook
<
T
>
(
hookName
:
ClientHookName
,
resultArg
?:
T
|
Promise
<
T
>
,
params
?:
any
)
{
if
(
!
this
.
hooks
[
hookName
])
{
// eslint-disable-next-line no-return-await
return
await
resultArg
}
const
hookType
=
getHookType
(
hookName
)
let
result
=
await
resultArg
for
(
const
hook
of
this
.
hooks
[
hookName
])
{
logger
.
info
(
`Running hook
${
hookName
}
of plugin
${
hook
.
plugin
.
name
}
`
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment