diff options
Diffstat (limited to 'support/doc/plugins/guide.md')
-rw-r--r-- | support/doc/plugins/guide.md | 24 |
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 | ||
882 | Now you can register hooks or settings, write CSS and add static directories to your plugin or your theme :) | 881 | Now you can register hooks or settings, write CSS and add static directories to your plugin or your theme :) |
882 | It'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, | ||
885 | and will be supported by web browsers. | ||
886 | If you want to write modern JavaScript, please use a transpiler like [Babel](https://babeljs.io/). | 886 | If you want to write modern JavaScript, please use a transpiler like [Babel](https://babeljs.io/). |
887 | If you want to use __Typescript__ see section below. | ||
888 | 887 | ||
889 | ### Typescript | 888 | **Typescript** |
889 | |||
890 | If you want to use __Typescript__, you can add __PeerTube__ types as dev dependencies: | ||
890 | 891 | ||
891 | You can add __PeerTube__ types as dev dependencies: | ||
892 | ``` | 892 | ``` |
893 | npm install --save-dev @peertube/peertube-types | 893 | npm install --save-dev @peertube/peertube-types |
894 | ``` | 894 | ``` |
895 | 895 | ||
896 | This package exposes *server* definition files by default: | 896 | This package exposes *server* definition files by default: |
897 | ```ts | 897 | ```ts |
898 | import { RegisterServerOptions } from '@peertube/peertube-types/server/types' | 898 | import { RegisterServerOptions } from '@peertube/peertube-types' |
899 | 899 | ||
900 | export async function register ({ registerHook }: RegisterServerOptions) { | 900 | export async function register ({ registerHook }: RegisterServerOptions) { |
901 | registerHook({ | 901 | registerHook({ |
@@ -907,8 +907,8 @@ export async function register ({ registerHook }: RegisterServerOptions) { | |||
907 | 907 | ||
908 | But it also exposes client types and various models used in __PeerTube__: | 908 | But it also exposes client types and various models used in __PeerTube__: |
909 | ```ts | 909 | ```ts |
910 | import { RegisterClientOptions } from '@larriereguichet/peertube-types/client/types'; | 910 | import { Video } from '@peertube/peertube-types'; |
911 | import { Video } from '@larriereguichet/peertube-types/shared'; | 911 | import { RegisterClientOptions } from '@peertube/peertube-types/client'; |
912 | 912 | ||
913 | function register({ registerHook, peertubeHelpers }: RegisterClientOptions) { | 913 | function 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 | ||
936 | export { register }; | 935 | export { 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 | ||