aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc
diff options
context:
space:
mode:
Diffstat (limited to 'support/doc')
-rw-r--r--support/doc/plugins/guide.md24
1 files changed, 11 insertions, 13 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md
index 0a91460f5..26fcb8987 100644
--- a/support/doc/plugins/guide.md
+++ b/support/doc/plugins/guide.md
@@ -37,7 +37,6 @@
37 - [Update README](#update-readme) 37 - [Update README](#update-readme)
38 - [Update package.json](#update-packagejson) 38 - [Update package.json](#update-packagejson)
39 - [Write code](#write-code) 39 - [Write code](#write-code)
40 - [Typescript](#typescript)
41 - [Add translations](#add-translations) 40 - [Add translations](#add-translations)
42 - [Build your plugin](#build-your-plugin) 41 - [Build your plugin](#build-your-plugin)
43 - [Test your plugin/theme](#test-your-plugintheme) 42 - [Test your plugin/theme](#test-your-plugintheme)
@@ -880,22 +879,23 @@ And if you don't need CSS or client script files, use an empty `array`:
880### Write code 879### Write code
881 880
882Now you can register hooks or settings, write CSS and add static directories to your plugin or your theme :) 881Now you can register hooks or settings, write CSS and add static directories to your plugin or your theme :)
882It's up to you to check the code you write will be compatible with the PeerTube NodeJS version, and will be supported by web browsers.
883
884**JavaScript**
883 885
884**Caution:** It's up to you to check the code you write will be compatible with the PeerTube NodeJS version,
885and will be supported by web browsers.
886If you want to write modern JavaScript, please use a transpiler like [Babel](https://babeljs.io/). 886If you want to write modern JavaScript, please use a transpiler like [Babel](https://babeljs.io/).
887If you want to use __Typescript__ see section below.
888 887
889### Typescript 888**Typescript**
889
890If you want to use __Typescript__, you can add __PeerTube__ types as dev dependencies:
890 891
891You can add __PeerTube__ types as dev dependencies:
892``` 892```
893npm install --save-dev @peertube/peertube-types 893npm install --save-dev @peertube/peertube-types
894``` 894```
895 895
896This package exposes *server* definition files by default: 896This package exposes *server* definition files by default:
897```ts 897```ts
898import { RegisterServerOptions } from '@peertube/peertube-types/server/types' 898import { RegisterServerOptions } from '@peertube/peertube-types'
899 899
900export async function register ({ registerHook }: RegisterServerOptions) { 900export async function register ({ registerHook }: RegisterServerOptions) {
901 registerHook({ 901 registerHook({
@@ -907,8 +907,8 @@ export async function register ({ registerHook }: RegisterServerOptions) {
907 907
908But it also exposes client types and various models used in __PeerTube__: 908But it also exposes client types and various models used in __PeerTube__:
909```ts 909```ts
910import { RegisterClientOptions } from '@larriereguichet/peertube-types/client/types'; 910import { Video } from '@peertube/peertube-types';
911import { Video } from '@larriereguichet/peertube-types/shared'; 911import { RegisterClientOptions } from '@peertube/peertube-types/client';
912 912
913function register({ registerHook, peertubeHelpers }: RegisterClientOptions) { 913function register({ registerHook, peertubeHelpers }: RegisterClientOptions) {
914 registerHook({ 914 registerHook({
@@ -926,16 +926,14 @@ function register({ registerHook, peertubeHelpers }: RegisterClientOptions) {
926 fetch(`${peertubeHelpers.getBaseRouterRoute()}/videos/${video.uuid}/captions`, { 926 fetch(`${peertubeHelpers.getBaseRouterRoute()}/videos/${video.uuid}/captions`, {
927 method: 'PUT', 927 method: 'PUT',
928 headers: peertubeHelpers.getAuthHeader(), 928 headers: peertubeHelpers.getAuthHeader(),
929 }) 929 }).then((res) => res.json())
930 .then((res) => res.json()) 930 .then((data) => console.log('Hi %s.', data));
931 .then((data) => console.log('Hi %s.', data));
932 }, 931 },
933 }); 932 });
934} 933}
935 934
936export { register }; 935export { register };
937``` 936```
938> Other types are accessible from the shared path `@peertube/peertube-types/shared`.
939 937
940### Add translations 938### Add translations
941 939