Skip to content

Commit

Permalink
4.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Sep 13, 2022
1 parent 6685ea1 commit d1f4248
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 36 deletions.
14 changes: 9 additions & 5 deletions dist/es5node/methods/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ var _net = _interopRequireDefault(require("net"));

var _path = _interopRequireDefault(require("path"));

var _microtime = _interopRequireDefault(require("microtime"));

var _rimraf = _interopRequireDefault(require("rimraf"));

var _detectNode = _interopRequireDefault(require("detect-node"));
Expand Down Expand Up @@ -679,10 +677,11 @@ function _cleanOldMessages() {
while (1) {
switch (_context15.prev = _context15.next) {
case 0:
olderThen = Date.now() - ttl;
olderThen = microSeconds() - ttl * 1000; // convert ttl to microseconds

_context15.next = 3;
return Promise.all(messageObjects.filter(function (obj) {
return obj.time / 1000 < olderThen;
return obj.time < olderThen;
}).map(function (obj) {
return unlink(obj.path)["catch"](function () {
return null;
Expand Down Expand Up @@ -1182,5 +1181,10 @@ function averageResponseTime() {
}

function microSeconds() {
return parseInt(_microtime["default"].now());
// convert nano to micro seconds
return parseInt(now() / 1000);
}

function now() {
return Number(process.hrtime.bigint()); // returns nanoseconds
}
2 changes: 0 additions & 2 deletions dist/esbrowser/method-chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import IndexeDbMethod from './methods/indexed-db.js';
import LocalstorageMethod from './methods/localstorage.js';
import SimulateMethod from './methods/simulate.js'; // the line below will be removed from es5/browser builds


import { isNode } from './util.js'; // order is important

var METHODS = [NativeMethod, // fastest
Expand All @@ -12,7 +11,6 @@ export function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
13 changes: 9 additions & 4 deletions dist/esbrowser/methods/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import os from 'os';
import events from 'events';
import net from 'net';
import path from 'path';
import micro from 'microtime';
import rimraf from 'rimraf';
import isNode from 'detect-node';
import PQueue from 'p-queue';
Expand Down Expand Up @@ -593,10 +592,11 @@ function _cleanOldMessages() {
while (1) {
switch (_context15.prev = _context15.next) {
case 0:
olderThen = Date.now() - ttl;
olderThen = microSeconds() - ttl * 1000; // convert ttl to microseconds

_context15.next = 3;
return Promise.all(messageObjects.filter(function (obj) {
return obj.time / 1000 < olderThen;
return obj.time < olderThen;
}).map(function (obj) {
return unlink(obj.path)["catch"](function () {
return null;
Expand Down Expand Up @@ -1085,5 +1085,10 @@ export function averageResponseTime() {
return 200;
}
export function microSeconds() {
return parseInt(micro.now());
// convert nano to micro seconds
return parseInt(now() / 1000);
}

function now() {
return Number(process.hrtime.bigint()); // returns nanoseconds
}
13 changes: 9 additions & 4 deletions dist/esnode/methods/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import os from 'os';
import events from 'events';
import net from 'net';
import path from 'path';
import micro from 'microtime';
import rimraf from 'rimraf';
import isNode from 'detect-node';
import PQueue from 'p-queue';
Expand Down Expand Up @@ -593,10 +592,11 @@ function _cleanOldMessages() {
while (1) {
switch (_context15.prev = _context15.next) {
case 0:
olderThen = Date.now() - ttl;
olderThen = microSeconds() - ttl * 1000; // convert ttl to microseconds

_context15.next = 3;
return Promise.all(messageObjects.filter(function (obj) {
return obj.time / 1000 < olderThen;
return obj.time < olderThen;
}).map(function (obj) {
return unlink(obj.path)["catch"](function () {
return null;
Expand Down Expand Up @@ -1085,5 +1085,10 @@ export function averageResponseTime() {
return 200;
}
export function microSeconds() {
return parseInt(micro.now());
// convert nano to micro seconds
return parseInt(now() / 1000);
}

function now() {
return Number(process.hrtime.bigint()); // returns nanoseconds
}
2 changes: 0 additions & 2 deletions dist/lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ var _localstorage = _interopRequireDefault(require("./methods/localstorage.js"))
var _simulate = _interopRequireDefault(require("./methods/simulate.js"));



var _util = require("./util.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
Expand All @@ -813,7 +812,6 @@ function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
2 changes: 1 addition & 1 deletion dist/lib/browser.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions dist/lib/method-chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ var _localstorage = _interopRequireDefault(require("./methods/localstorage.js"))
var _simulate = _interopRequireDefault(require("./methods/simulate.js"));



var _util = require("./util.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
Expand All @@ -34,7 +33,6 @@ function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
14 changes: 9 additions & 5 deletions dist/lib/methods/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ var _net = _interopRequireDefault(require("net"));

var _path = _interopRequireDefault(require("path"));

var _microtime = _interopRequireDefault(require("microtime"));

var _rimraf = _interopRequireDefault(require("rimraf"));

var _detectNode = _interopRequireDefault(require("detect-node"));
Expand Down Expand Up @@ -679,10 +677,11 @@ function _cleanOldMessages() {
while (1) {
switch (_context15.prev = _context15.next) {
case 0:
olderThen = Date.now() - ttl;
olderThen = microSeconds() - ttl * 1000; // convert ttl to microseconds

_context15.next = 3;
return Promise.all(messageObjects.filter(function (obj) {
return obj.time / 1000 < olderThen;
return obj.time < olderThen;
}).map(function (obj) {
return unlink(obj.path)["catch"](function () {
return null;
Expand Down Expand Up @@ -1182,5 +1181,10 @@ function averageResponseTime() {
}

function microSeconds() {
return parseInt(_microtime["default"].now());
// convert nano to micro seconds
return parseInt(now() / 1000);
}

function now() {
return Number(process.hrtime.bigint()); // returns nanoseconds
}
2 changes: 0 additions & 2 deletions docs/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ var _localstorage = _interopRequireDefault(require("./methods/localstorage.js"))
var _simulate = _interopRequireDefault(require("./methods/simulate.js"));



var _util = require("./util.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
Expand All @@ -804,7 +803,6 @@ function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
2 changes: 0 additions & 2 deletions docs/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ var _localstorage = _interopRequireDefault(require("./methods/localstorage.js"))
var _simulate = _interopRequireDefault(require("./methods/simulate.js"));



var _util = require("./util.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
Expand All @@ -804,7 +803,6 @@ function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
2 changes: 0 additions & 2 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ var _localstorage = _interopRequireDefault(require("./methods/localstorage.js"))
var _simulate = _interopRequireDefault(require("./methods/simulate.js"));



var _util = require("./util.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
Expand All @@ -804,7 +803,6 @@ function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
2 changes: 0 additions & 2 deletions docs/leader-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ var _localstorage = _interopRequireDefault(require("./methods/localstorage.js"))
var _simulate = _interopRequireDefault(require("./methods/simulate.js"));



var _util = require("./util.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
Expand All @@ -804,7 +803,6 @@ function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
2 changes: 0 additions & 2 deletions docs/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ var _localstorage = _interopRequireDefault(require("./methods/localstorage.js"))
var _simulate = _interopRequireDefault(require("./methods/simulate.js"));



var _util = require("./util.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
Expand All @@ -804,7 +803,6 @@ function chooseMethod(options) {
var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean); // the line below will be removed from es5/browser builds



if (options.type) {
if (options.type === 'simulate') {
// only use simulate-method if directly chosen
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "broadcast-channel",
"version": "4.14.0",
"version": "4.15.0",
"description": "A BroadcastChannel that works in New Browsers, Old Browsers, WebWorkers and NodeJs",
"exports": {
".": {
Expand Down

0 comments on commit d1f4248

Please sign in to comment.