Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2020-05-10 20:38:15 +0300
committerGitHub <noreply@github.com>2020-05-10 20:38:15 +0300
commitab81910fa7b8834953ae76ad8597ed9f83c25ebb (patch)
tree71a9d681767bee36aa5996915a32e67d93a96e9b
parentdf896285fe2f75dea2f60e95326bb8a6f59371ab (diff)
parentdb9ec006c1faaa5758e7593216b6a31fb08ded26 (diff)
Merge pull request #1697 from webtorrent/chromeapp2
-rw-r--r--README.md34
-rw-r--r--package.json11
2 files changed, 23 insertions, 22 deletions
diff --git a/README.md b/README.md
index e484944..e1fffd8 100644
--- a/README.md
+++ b/README.md
@@ -174,8 +174,8 @@ you use [node](http://nodejs.org/)-style require() to organize your browser code
##### Webpack
-WebTorrent also works with [webpack](http://webpack.github.io/), a module bundler similar
-to browserify. However, webpack requires the following extra configuration:
+WebTorrent also works with [webpack](https://webpack.js.org/), another module
+bundler. However, webpack requires the following extra configuration:
```js
{
@@ -186,22 +186,8 @@ to browserify. However, webpack requires the following extra configuration:
}
```
-If you are on webpack 1.x, you will also need to add the `json-loader`:
-```js
-{
- module: {
- loaders: [
- // make sure to install the 'json-loader' package: npm install json-loader
- {
- test: /\.json$/,
- loader: 'json'
- }
- ]
- }
-}
-```
-
-Otherwise you could also directly use the pre-built version via `require('webtorrent/webtorrent.min')`.
+Or, you can just use the pre-built version via
+`require('webtorrent/webtorrent.min.js')` and skip the webpack configuration.
##### Script tag
@@ -220,6 +206,18 @@ MaxCDN) for easy inclusion on your site:
<script src="https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js"></script>
```
+##### Chrome App
+
+If you want to use WebTorrent in a
+[Chrome App](https://developer.chrome.com/apps/about_apps), you can include the
+following script:
+
+```html
+<script src="webtorrent.chromeapp.js"></script>
+```
+
+Be sure to enable the `chrome.sockets.udp` and `chrome.sockets.tcp` permissions!
+
#### In Node.js
WebTorrent also works in node.js, using the *same npm package!* It's mad science!
diff --git a/package.json b/package.json
index 29c0052..23766d2 100644
--- a/package.json
+++ b/package.json
@@ -79,7 +79,7 @@
"airtap": "^3.0.0",
"babel-minify": "^0.5.1",
"bittorrent-tracker": "^9.14.0",
- "browserify": "^16.4.0",
+ "browserify": "^16.5.0",
"disc": "^1.3.3",
"electron": "^8.0.0",
"finalhandler": "^1.0.0",
@@ -117,11 +117,14 @@
"url": "git://github.com/webtorrent/webtorrent.git"
},
"scripts": {
- "build": "browserify --standalone WebTorrent . | minify --mangle=false > webtorrent.min.js",
- "build-debug": "browserify --standalone WebTorrent . > webtorrent.debug.js",
+ "build": "npm run build-js && npm run build-chromeapp",
+ "build-chromeapp": "browserify --browser-field=chromeapp --standalone WebTorrent . | minify --mangle=false > webtorrent.chromeapp.js",
+ "build-chromeapp-debug": "browserify --browser-field=chromeapp --standalone WebTorrent . > webtorrent.chromeapp.js",
+ "build-js": "browserify --standalone WebTorrent . | minify --mangle=false > webtorrent.min.js",
+ "build-js-debug": "browserify --standalone WebTorrent . > webtorrent.debug.js",
"size": "npm run size-js && npm run size-disc",
- "size-disc": "browserify --full-paths . | discify --open",
"size-js": "npm run build && cat webtorrent.min.js | gzip | wc -c",
+ "size-disc": "browserify --full-paths . | discify --open",
"test": "standard && npm run test-node && npm run test-browser",
"test-browser": "airtap -- test/*.js test/browser/*.js",
"test-browser-local": "airtap --local -- test/*.js test/browser/*.js",