broadcast-channel
Advanced tools
Comparing version 2.1.8 to 2.1.9
import BroadcastChannel from '../'; | ||
export type LeaderElectionOptions = { | ||
/** | ||
* This value decides how often instances will renegotiate who is leader. | ||
* Probably should be at least 2x bigger than responseTime. | ||
*/ | ||
fallbackInterval?: number; | ||
/** | ||
* This timer value is used when resolving which instance should be leader. | ||
* In case when your application elects more than one leader increase this value. | ||
*/ | ||
responseTime?: number; | ||
}; | ||
@@ -6,0 +15,0 @@ |
{ | ||
"name": "broadcast-channel", | ||
"version": "2.1.8", | ||
"description": "A BroadcastChannel implementation that works with new browsers, older browsers and Node.js", | ||
"version": "2.1.9", | ||
"description": "A BroadcastChannel shim/polyfill that works in New Browsers, Old Browsers, WebWorkers and NodeJs", | ||
"homepage": "https://github.com/pubkey/broadcast-channel#readme", | ||
@@ -63,3 +63,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@babel/runtime": "7.1.5", | ||
"@babel/runtime": "7.3.1", | ||
"detect-node": "2.0.4", | ||
@@ -69,32 +69,32 @@ "js-sha3": "0.8.0", | ||
"nano-time": "1.0.0", | ||
"rimraf": "2.6.2", | ||
"rimraf": "2.6.3", | ||
"unload": "2.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.1.5", | ||
"@babel/core": "7.1.5", | ||
"@babel/cli": "7.2.3", | ||
"@babel/core": "7.2.2", | ||
"@babel/plugin-check-constants": "7.0.0-beta.38", | ||
"@babel/plugin-proposal-object-rest-spread": "7.0.0", | ||
"@babel/plugin-transform-member-expression-literals": "7.0.0", | ||
"@babel/plugin-transform-property-literals": "7.0.0", | ||
"@babel/plugin-transform-runtime": "7.1.0", | ||
"@babel/polyfill": "7.0.0", | ||
"@babel/preset-env": "7.1.5", | ||
"@babel/types": "7.1.5", | ||
"@babel/plugin-proposal-object-rest-spread": "7.3.1", | ||
"@babel/plugin-transform-member-expression-literals": "7.2.0", | ||
"@babel/plugin-transform-property-literals": "7.2.0", | ||
"@babel/plugin-transform-runtime": "7.2.0", | ||
"@babel/polyfill": "7.2.5", | ||
"@babel/preset-env": "7.3.1", | ||
"@babel/types": "7.3.0", | ||
"@types/core-js": "2.5.0", | ||
"assert": "1.4.1", | ||
"async-test-util": "1.6.1", | ||
"async-test-util": "1.6.3", | ||
"browserify": "16.2.3", | ||
"child-process-promise": "2.2.1", | ||
"clone": "2.1.2", | ||
"concurrently": "4.0.1", | ||
"concurrently": "4.1.0", | ||
"convert-hrtime": "2.0.0", | ||
"copyfiles": "2.1.0", | ||
"cross-env": "5.2.0", | ||
"eslint": "5.9.0", | ||
"eslint": "5.13.0", | ||
"gzip-size-cli": "3.0.0", | ||
"http-server": "0.11.1", | ||
"karma": "3.1.1", | ||
"karma-babel-preprocessor": "7.0.0", | ||
"karma-browserify": "5.3.0", | ||
"karma": "4.0.0", | ||
"karma-babel-preprocessor": "8.0.0", | ||
"karma-browserify": "6.0.0", | ||
"karma-chrome-launcher": "2.2.0", | ||
@@ -110,13 +110,14 @@ "karma-coverage": "1.1.2", | ||
"mocha": "5.2.0", | ||
"node": "11.1.0", | ||
"node": "11.9.0", | ||
"pre-commit": "1.2.2", | ||
"random-int": "1.0.0", | ||
"random-token": "0.0.8", | ||
"testcafe": "0.23.2", | ||
"testcafe-hammerhead": "14.4.1", | ||
"testcafe": "0.23.3", | ||
"testcafe-hammerhead": "14.4.12", | ||
"ts-node": "7.0.1", | ||
"typescript": "3.1.6", | ||
"typescript": "3.3.1", | ||
"uglifyjs-webpack-plugin": "2.1.1", | ||
"watchify": "3.11.0", | ||
"webpack": "4.25.1", | ||
"webpack-cli": "3.1.2" | ||
"webpack": "4.29.0", | ||
"webpack-cli": "3.2.1" | ||
}, | ||
@@ -123,0 +124,0 @@ "browser": { |
@@ -153,2 +153,15 @@ | ||
If more than one tab is becoming leader adjust `LeaderElectionOptions` configuration. | ||
```js | ||
const LeaderElection = require('broadcast-channel/leader-election'); | ||
const elector = LeaderElection.create(channel, { | ||
fallbackInterval: 2000, // optional configuration for how often will renegotiation for leader occur | ||
responseTime: 1000, // optional configuration for how long will instances have to respond | ||
}); | ||
elector.awaitLeadership().then(()=> { | ||
console.log('this tab is now leader'); | ||
}) | ||
``` | ||
Let the leader die. (automatically happens if the tab is closed or the process exits). | ||
@@ -155,0 +168,0 @@ |
205703
5668
196
48
+ Added@babel/runtime@7.3.1(transitive)
+ Addedrimraf@2.6.3(transitive)
- Removedrimraf@2.6.2(transitive)
Updated@babel/runtime@7.3.1
Updatedrimraf@2.6.3