aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc/plugins/guide.md
diff options
context:
space:
mode:
Diffstat (limited to 'support/doc/plugins/guide.md')
-rw-r--r--support/doc/plugins/guide.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md
index 4a0d318a7..5c96d1b03 100644
--- a/support/doc/plugins/guide.md
+++ b/support/doc/plugins/guide.md
@@ -883,6 +883,39 @@ Now you can register hooks or settings, write CSS and add static directories to
883**Caution:** It's up to you to check the code you write will be compatible with the PeerTube NodeJS version, 883**Caution:** It's up to you to check the code you write will be compatible with the PeerTube NodeJS version,
884and will be supported by web browsers. 884and will be supported by web browsers.
885If you want to write modern JavaScript, please use a transpiler like [Babel](https://babeljs.io/). 885If you want to write modern JavaScript, please use a transpiler like [Babel](https://babeljs.io/).
886If you want to use __Typescript__ see section below.
887
888### Typescript
889
890You can add __PeerTube__ types as dev dependencies:
891```
892npm install --dev @peertube/peertube-types
893```
894
895This package exposes *server* definition files by default:
896```ts
897import { RegisterServerOptions } from '@peertube/peertube-types'
898
899export async function register ({ registerHook }: RegisterServerOptions) {
900 registerHook({
901 target: 'action:application.listening',
902 handler: () => displayHelloWorld()
903 })
904}
905```
906
907But it also exposes client types and various models used in __PeerTube__:
908```ts
909import { RegisterClientOptions } from '@peertube/peertube-types/client'
910
911export function register ({ registerHook, peertubeHelpers }: RegisterClientOptions) {
912 registerHook({
913 target: 'action:application.init',
914 handler: () => onApplicationInit(peertubeHelpers)
915 })
916}
917```
918> Other types are accessible from the shared path `@peertube/peertube-types/shared`.
886 919
887### Add translations 920### Add translations
888 921