pusher-js 7.4.0 → 7.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Pusher JavaScript Library v7.4.0
2
+ * Pusher JavaScript Library v7.4.1
3
3
  * https://pusher.com/
4
4
  *
5
5
  * Copyright 2020, Pusher
@@ -3299,7 +3299,7 @@ function safeJSONStringify(source) {
3299
3299
 
3300
3300
  // CONCATENATED MODULE: ./src/core/defaults.ts
3301
3301
  var Defaults = {
3302
- VERSION: "7.4.0",
3302
+ VERSION: "7.4.1",
3303
3303
  PROTOCOL: 7,
3304
3304
  wsPort: 80,
3305
3305
  wssPort: 443,
@@ -4495,10 +4495,11 @@ var presence_channel_extends = (undefined && undefined.__extends) || (function (
4495
4495
  };
4496
4496
  })();
4497
4497
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
4498
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4498
4499
  return new (P || (P = Promise))(function (resolve, reject) {
4499
4500
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4500
4501
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4501
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
4502
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4502
4503
  step((generator = generator.apply(thisArg, _arguments || [])).next());
4503
4504
  });
4504
4505
  };
@@ -5837,7 +5838,7 @@ function replaceHost(url, hostname) {
5837
5838
  return urlParts[1] + hostname + urlParts[3];
5838
5839
  }
5839
5840
  function randomNumber(max) {
5840
- return Math.floor(Math.random() * max);
5841
+ return worker_runtime.randomInt(max);
5841
5842
  }
5842
5843
  function randomString(length) {
5843
5844
  var result = [];
@@ -6121,6 +6122,14 @@ var Worker = {
6121
6122
  },
6122
6123
  getNetwork: function () {
6123
6124
  return net_info_Network;
6125
+ },
6126
+ randomInt: function (max) {
6127
+ var random = function () {
6128
+ var crypto = window.crypto || window['msCrypto'];
6129
+ var random = crypto.getRandomValues(new Uint32Array(1))[0];
6130
+ return random / Math.pow(2, 32);
6131
+ };
6132
+ return Math.floor(random() * max);
6124
6133
  }
6125
6134
  };
6126
6135
  /* harmony default export */ var worker_runtime = (Worker);
@@ -6507,7 +6516,7 @@ function getEnableStatsConfig(opts) {
6507
6516
  return false;
6508
6517
  }
6509
6518
  function buildUserAuthenticator(opts) {
6510
- var userAuthentication = __assign({}, defaults.userAuthentication, opts.userAuthentication);
6519
+ var userAuthentication = __assign(__assign({}, defaults.userAuthentication), opts.userAuthentication);
6511
6520
  if ('customHandler' in userAuthentication &&
6512
6521
  userAuthentication['customHandler'] != null) {
6513
6522
  return userAuthentication['customHandler'];
@@ -6517,7 +6526,7 @@ function buildUserAuthenticator(opts) {
6517
6526
  function buildChannelAuth(opts, pusher) {
6518
6527
  var channelAuthorization;
6519
6528
  if ('channelAuthorization' in opts) {
6520
- channelAuthorization = __assign({}, defaults.channelAuthorization, opts.channelAuthorization);
6529
+ channelAuthorization = __assign(__assign({}, defaults.channelAuthorization), opts.channelAuthorization);
6521
6530
  }
6522
6531
  else {
6523
6532
  channelAuthorization = {
@@ -6736,7 +6745,7 @@ var pusher_Pusher = (function () {
6736
6745
  this.config = getConfig(options, this);
6737
6746
  this.channels = factory.createChannels();
6738
6747
  this.global_emitter = new dispatcher();
6739
- this.sessionID = Math.floor(Math.random() * 1000000000);
6748
+ this.sessionID = worker_runtime.randomInt(1000000000);
6740
6749
  this.timeline = new timeline_timeline(this.key, this.sessionID, {
6741
6750
  cluster: this.config.cluster,
6742
6751
  features: Pusher.getClientFeatures(),