Ver Fonte

docs: update pluginOptions option, close #446

DIYgod há 5 anos atrás
pai
commit
e7e3665526
4 ficheiros alterados com 49 adições e 2 exclusões
  1. 0 2
      .eslintrc
  2. 1 0
      .travis.yml
  3. 24 0
      docs/guide.md
  4. 24 0
      docs/zh/guide.md

+ 0 - 2
.eslintrc

@@ -11,7 +11,6 @@
         "node": true,
     },
     "rules": {
-        "no-console": 0,
         "block-scoped-var": 1,
         "curly": 1,
         "eqeqeq": 1,
@@ -24,7 +23,6 @@
         "func-call-spacing": 1,
         "keyword-spacing": 1,
         "linebreak-style": 1,
-        "lines-around-comment": 1,
         "no-multiple-empty-lines": 1,
         "space-infix-ops": 1,
         "arrow-spacing": 1,

+ 1 - 0
.travis.yml

@@ -2,6 +2,7 @@ language: node_js
 node_js:
   - lts/*
 script:
+  - npm run build
   - npm run docs:build
 deploy:
   provider: pages

+ 24 - 0
docs/guide.md

@@ -489,7 +489,13 @@ const dp = new DPlayer({
         url: 'demo.m3u8',
         type: 'hls',
     },
+    pluginOptions: {
+        hls: {
+            // hls config
+        },
+    },
 });
+console.log(dp.plugins.hls); // Hls instance
 ```
 
 ```js
@@ -528,7 +534,13 @@ const dp = new DPlayer({
         url: 'demo.mpd',
         type: 'dash',
     },
+    pluginOptions: {
+        dash: {
+            // dash config
+        },
+    },
 });
+console.log(dp.plugins.dash); // Dash instance
 ```
 
 ```js
@@ -604,7 +616,13 @@ const dp = new DPlayer({
         url: 'demo.flv',
         type: 'flv',
     },
+    pluginOptions: {
+        flv: {
+            // flv config
+        },
+    },
 });
+console.log(dp.plugins.flv); // flv instance
 ```
 
 ```js
@@ -653,7 +671,13 @@ const dp = new DPlayer({
         url: 'magnet:demo',
         type: 'webtorrent',
     },
+    pluginOptions: {
+        webtorrent: {
+            // webtorrent config
+        },
+    },
 });
+console.log(dp.plugins.webtorrent); // WebTorrent instance
 ```
 
 ```js

+ 24 - 0
docs/zh/guide.md

@@ -475,7 +475,13 @@ const dp = new DPlayer({
         url: 'demo.m3u8',
         type: 'hls',
     },
+    pluginOptions: {
+        hls: {
+            // hls config
+        },
+    },
 });
+console.log(dp.plugins.hls); // Hls 实例
 ```
 
 ```js
@@ -514,7 +520,13 @@ const dp = new DPlayer({
         url: 'demo.mpd',
         type: 'dash',
     },
+    pluginOptions: {
+        dash: {
+            // dash config
+        },
+    },
 });
+console.log(dp.plugins.dash); // Dash 实例
 ```
 
 ```js
@@ -590,7 +602,13 @@ const dp = new DPlayer({
         url: 'demo.flv',
         type: 'flv',
     },
+    pluginOptions: {
+        flv: {
+            // flv config
+        },
+    },
 });
+console.log(dp.plugins.flv); // flv 实例
 ```
 
 ```js
@@ -639,7 +657,13 @@ const dp = new DPlayer({
         url: 'magnet:demo',
         type: 'webtorrent',
     },
+    pluginOptions: {
+        webtorrent: {
+            // webtorrent config
+        },
+    },
 });
+console.log(dp.plugins.webtorrent); // WebTorrent 实例
 ```
 
 ```js