diff options
Diffstat (limited to 'shared/models/plugins/client-hook.model.ts')
-rw-r--r-- | shared/models/plugins/client-hook.model.ts | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/shared/models/plugins/client-hook.model.ts b/shared/models/plugins/client-hook.model.ts index 89400003e..bf444fe5a 100644 --- a/shared/models/plugins/client-hook.model.ts +++ b/shared/models/plugins/client-hook.model.ts | |||
@@ -1,38 +1,48 @@ | |||
1 | export type ClientFilterHookName = | 1 | // Data from API hooks: {hookType}:api.{location}.{elementType}.{actionType}.{target} |
2 | 'filter:api.videos.list.trending.params' | | ||
3 | 'filter:api.videos.list.trending.result' | | ||
4 | 2 | ||
5 | 'filter:api.videos.list.local.params' | | 3 | export const clientFilterHookObject = { |
6 | 'filter:api.videos.list.local.result' | | 4 | 'filter:api.trending-videos.videos.list.params': true, |
5 | 'filter:api.trending-videos.videos.list.result': true, | ||
7 | 6 | ||
8 | 'filter:api.videos.list.recently-added.params' | | 7 | 'filter:api.local-videos.videos.list.params': true, |
9 | 'filter:api.videos.list.recently-added.result' | | 8 | 'filter:api.local-videos.videos.list.result': true, |
10 | 9 | ||
11 | 'filter:api.videos.list.user-subscriptions.params' | | 10 | 'filter:api.recently-added-videos.videos.list.params': true, |
12 | 'filter:api.videos.list.user-subscriptions.result' | | 11 | 'filter:api.recently-added-videos.videos.list.result': true, |
13 | 12 | ||
14 | 'filter:api.video-watch.video.get.params' | | 13 | 'filter:api.user-subscriptions-videos.videos.list.params': true, |
15 | 'filter:api.video-watch.video.get.result' | | 14 | 'filter:api.user-subscriptions-videos.videos.list.result': true, |
16 | 15 | ||
17 | 'filter:api.video-watch.video-threads.list.params' | | 16 | 'filter:api.video-watch.video.get.params': true, |
18 | 'filter:api.video-watch.video-threads.list.result' | | 17 | 'filter:api.video-watch.video.get.result': true, |
19 | 18 | ||
20 | 'filter:api.video-watch.video-thread-replies.list.params' | | 19 | 'filter:api.video-watch.video-threads.list.params': true, |
21 | 'filter:api.video-watch.video-thread-replies.list.result' | | 20 | 'filter:api.video-watch.video-threads.list.result': true, |
22 | 21 | ||
23 | 'filter:api.search.videos.list.params' | | 22 | 'filter:api.video-watch.video-thread-replies.list.params': true, |
24 | 'filter:api.search.videos.list.result' | | 23 | 'filter:api.video-watch.video-thread-replies.list.result': true, |
25 | 'filter:api.search.video-channels.list.params' | | ||
26 | 'filter:api.search.video-channels.list.result' | ||
27 | 24 | ||
28 | export type ClientActionHookName = | 25 | 'filter:api.search.videos.list.params': true, |
29 | 'action:application.init' | | 26 | 'filter:api.search.videos.list.result': true, |
27 | 'filter:api.search.video-channels.list.params': true, | ||
28 | 'filter:api.search.video-channels.list.result': true | ||
29 | } | ||
30 | |||
31 | export type ClientFilterHookName = keyof typeof clientFilterHookObject | ||
32 | |||
33 | export const clientActionHookObject = { | ||
34 | 'action:application.init': true, | ||
30 | 35 | ||
31 | 'action:video-watch.init' | | 36 | 'action:video-watch.init': true, |
37 | 'action:video-watch.video.loaded': true, | ||
38 | |||
39 | 'action:search.init': true | ||
40 | } | ||
32 | 41 | ||
33 | 'action:video-watch.video.loaded' | 42 | export type ClientActionHookName = keyof typeof clientActionHookObject |
34 | 43 | ||
35 | export type ClientHookName = ClientActionHookName | ClientFilterHookName | 44 | export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject) |
45 | export type ClientHookName = keyof typeof clientHookObject | ||
36 | 46 | ||
37 | export interface ClientHook { | 47 | export interface ClientHook { |
38 | runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T> | 48 | runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T> |