pusher-js 8.0.2 → 8.2.0

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 v8.0.2
2
+ * Pusher JavaScript Library v8.2.0
3
3
  * https://pusher.com/
4
4
  *
5
5
  * Copyright 2020, Pusher
@@ -2963,6 +2963,9 @@ module.exports = __webpack_require__(5).default;
2963
2963
  // ESM COMPAT FLAG
2964
2964
  __webpack_require__.r(__webpack_exports__);
2965
2965
 
2966
+ // EXPORTS
2967
+ __webpack_require__.d(__webpack_exports__, "default", function() { return /* binding */ pusher_with_encryption_PusherWithEncryption; });
2968
+
2966
2969
  // CONCATENATED MODULE: ./src/core/base64.ts
2967
2970
  function encode(s) {
2968
2971
  return btoa(utob(s));
@@ -3005,43 +3008,28 @@ var btoa = self.btoa ||
3005
3008
  };
3006
3009
 
3007
3010
  // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
3008
- var Timer = (function () {
3009
- function Timer(set, clear, delay, callback) {
3010
- var _this = this;
3011
+ class Timer {
3012
+ constructor(set, clear, delay, callback) {
3011
3013
  this.clear = clear;
3012
- this.timer = set(function () {
3013
- if (_this.timer) {
3014
- _this.timer = callback(_this.timer);
3014
+ this.timer = set(() => {
3015
+ if (this.timer) {
3016
+ this.timer = callback(this.timer);
3015
3017
  }
3016
3018
  }, delay);
3017
3019
  }
3018
- Timer.prototype.isRunning = function () {
3020
+ isRunning() {
3019
3021
  return this.timer !== null;
3020
- };
3021
- Timer.prototype.ensureAborted = function () {
3022
+ }
3023
+ ensureAborted() {
3022
3024
  if (this.timer) {
3023
3025
  this.clear(this.timer);
3024
3026
  this.timer = null;
3025
3027
  }
3026
- };
3027
- return Timer;
3028
- }());
3028
+ }
3029
+ }
3029
3030
  /* harmony default export */ var abstract_timer = (Timer);
3030
3031
 
3031
3032
  // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
3032
- var __extends = (undefined && undefined.__extends) || (function () {
3033
- var extendStatics = function (d, b) {
3034
- extendStatics = Object.setPrototypeOf ||
3035
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3036
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3037
- return extendStatics(d, b);
3038
- };
3039
- return function (d, b) {
3040
- extendStatics(d, b);
3041
- function __() { this.constructor = d; }
3042
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3043
- };
3044
- })();
3045
3033
 
3046
3034
  function timers_clearTimeout(timer) {
3047
3035
  self.clearTimeout(timer);
@@ -3049,33 +3037,27 @@ function timers_clearTimeout(timer) {
3049
3037
  function timers_clearInterval(timer) {
3050
3038
  self.clearInterval(timer);
3051
3039
  }
3052
- var OneOffTimer = (function (_super) {
3053
- __extends(OneOffTimer, _super);
3054
- function OneOffTimer(delay, callback) {
3055
- return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
3040
+ class timers_OneOffTimer extends abstract_timer {
3041
+ constructor(delay, callback) {
3042
+ super(setTimeout, timers_clearTimeout, delay, function (timer) {
3056
3043
  callback();
3057
3044
  return null;
3058
- }) || this;
3045
+ });
3059
3046
  }
3060
- return OneOffTimer;
3061
- }(abstract_timer));
3062
-
3063
- var PeriodicTimer = (function (_super) {
3064
- __extends(PeriodicTimer, _super);
3065
- function PeriodicTimer(delay, callback) {
3066
- return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
3047
+ }
3048
+ class timers_PeriodicTimer extends abstract_timer {
3049
+ constructor(delay, callback) {
3050
+ super(setInterval, timers_clearInterval, delay, function (timer) {
3067
3051
  callback();
3068
3052
  return timer;
3069
- }) || this;
3053
+ });
3070
3054
  }
3071
- return PeriodicTimer;
3072
- }(abstract_timer));
3073
-
3055
+ }
3074
3056
 
3075
3057
  // CONCATENATED MODULE: ./src/core/util.ts
3076
3058
 
3077
3059
  var Util = {
3078
- now: function () {
3060
+ now() {
3079
3061
  if (Date.now) {
3080
3062
  return Date.now();
3081
3063
  }
@@ -3083,14 +3065,10 @@ var Util = {
3083
3065
  return new Date().valueOf();
3084
3066
  }
3085
3067
  },
3086
- defer: function (callback) {
3087
- return new OneOffTimer(0, callback);
3068
+ defer(callback) {
3069
+ return new timers_OneOffTimer(0, callback);
3088
3070
  },
3089
- method: function (name) {
3090
- var args = [];
3091
- for (var _i = 1; _i < arguments.length; _i++) {
3092
- args[_i - 1] = arguments[_i];
3093
- }
3071
+ method(name, ...args) {
3094
3072
  var boundArguments = Array.prototype.slice.call(arguments, 1);
3095
3073
  return function (object) {
3096
3074
  return object[name].apply(object, boundArguments.concat(arguments));
@@ -3102,11 +3080,7 @@ var Util = {
3102
3080
  // CONCATENATED MODULE: ./src/core/utils/collections.ts
3103
3081
 
3104
3082
 
3105
- function extend(target) {
3106
- var sources = [];
3107
- for (var _i = 1; _i < arguments.length; _i++) {
3108
- sources[_i - 1] = arguments[_i];
3109
- }
3083
+ function extend(target, ...sources) {
3110
3084
  for (var i = 0; i < sources.length; i++) {
3111
3085
  var extensions = sources[i];
3112
3086
  for (var property in extensions) {
@@ -3299,7 +3273,7 @@ function safeJSONStringify(source) {
3299
3273
 
3300
3274
  // CONCATENATED MODULE: ./src/core/defaults.ts
3301
3275
  var Defaults = {
3302
- VERSION: "8.0.2",
3276
+ VERSION: "8.2.0",
3303
3277
  PROTOCOL: 7,
3304
3278
  wsPort: 80,
3305
3279
  wssPort: 443,
@@ -3368,14 +3342,14 @@ var sockjs = {
3368
3342
 
3369
3343
  // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
3370
3344
 
3371
- var callback_registry_CallbackRegistry = (function () {
3372
- function CallbackRegistry() {
3345
+ class callback_registry_CallbackRegistry {
3346
+ constructor() {
3373
3347
  this._callbacks = {};
3374
3348
  }
3375
- CallbackRegistry.prototype.get = function (name) {
3349
+ get(name) {
3376
3350
  return this._callbacks[prefix(name)];
3377
- };
3378
- CallbackRegistry.prototype.add = function (name, callback, context) {
3351
+ }
3352
+ add(name, callback, context) {
3379
3353
  var prefixedEventName = prefix(name);
3380
3354
  this._callbacks[prefixedEventName] =
3381
3355
  this._callbacks[prefixedEventName] || [];
@@ -3383,8 +3357,8 @@ var callback_registry_CallbackRegistry = (function () {
3383
3357
  fn: callback,
3384
3358
  context: context
3385
3359
  });
3386
- };
3387
- CallbackRegistry.prototype.remove = function (name, callback, context) {
3360
+ }
3361
+ remove(name, callback, context) {
3388
3362
  if (!name && !callback && !context) {
3389
3363
  this._callbacks = {};
3390
3364
  return;
@@ -3396,8 +3370,8 @@ var callback_registry_CallbackRegistry = (function () {
3396
3370
  else {
3397
3371
  this.removeAllCallbacks(names);
3398
3372
  }
3399
- };
3400
- CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
3373
+ }
3374
+ removeCallback(names, callback, context) {
3401
3375
  apply(names, function (name) {
3402
3376
  this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
3403
3377
  return ((callback && callback !== binding.fn) ||
@@ -3407,15 +3381,13 @@ var callback_registry_CallbackRegistry = (function () {
3407
3381
  delete this._callbacks[name];
3408
3382
  }
3409
3383
  }, this);
3410
- };
3411
- CallbackRegistry.prototype.removeAllCallbacks = function (names) {
3384
+ }
3385
+ removeAllCallbacks(names) {
3412
3386
  apply(names, function (name) {
3413
3387
  delete this._callbacks[name];
3414
3388
  }, this);
3415
- };
3416
- return CallbackRegistry;
3417
- }());
3418
- /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
3389
+ }
3390
+ }
3419
3391
  function prefix(name) {
3420
3392
  return '_' + name;
3421
3393
  }
@@ -3423,38 +3395,38 @@ function prefix(name) {
3423
3395
  // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
3424
3396
 
3425
3397
 
3426
- var dispatcher_Dispatcher = (function () {
3427
- function Dispatcher(failThrough) {
3428
- this.callbacks = new callback_registry();
3398
+ class dispatcher_Dispatcher {
3399
+ constructor(failThrough) {
3400
+ this.callbacks = new callback_registry_CallbackRegistry();
3429
3401
  this.global_callbacks = [];
3430
3402
  this.failThrough = failThrough;
3431
3403
  }
3432
- Dispatcher.prototype.bind = function (eventName, callback, context) {
3404
+ bind(eventName, callback, context) {
3433
3405
  this.callbacks.add(eventName, callback, context);
3434
3406
  return this;
3435
- };
3436
- Dispatcher.prototype.bind_global = function (callback) {
3407
+ }
3408
+ bind_global(callback) {
3437
3409
  this.global_callbacks.push(callback);
3438
3410
  return this;
3439
- };
3440
- Dispatcher.prototype.unbind = function (eventName, callback, context) {
3411
+ }
3412
+ unbind(eventName, callback, context) {
3441
3413
  this.callbacks.remove(eventName, callback, context);
3442
3414
  return this;
3443
- };
3444
- Dispatcher.prototype.unbind_global = function (callback) {
3415
+ }
3416
+ unbind_global(callback) {
3445
3417
  if (!callback) {
3446
3418
  this.global_callbacks = [];
3447
3419
  return this;
3448
3420
  }
3449
- this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
3421
+ this.global_callbacks = filter(this.global_callbacks || [], c => c !== callback);
3450
3422
  return this;
3451
- };
3452
- Dispatcher.prototype.unbind_all = function () {
3423
+ }
3424
+ unbind_all() {
3453
3425
  this.unbind();
3454
3426
  this.unbind_global();
3455
3427
  return this;
3456
- };
3457
- Dispatcher.prototype.emit = function (eventName, data, metadata) {
3428
+ }
3429
+ emit(eventName, data, metadata) {
3458
3430
  for (var i = 0; i < this.global_callbacks.length; i++) {
3459
3431
  this.global_callbacks[i](eventName, data);
3460
3432
  }
@@ -3475,120 +3447,85 @@ var dispatcher_Dispatcher = (function () {
3475
3447
  this.failThrough(eventName, data);
3476
3448
  }
3477
3449
  return this;
3478
- };
3479
- return Dispatcher;
3480
- }());
3481
- /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
3450
+ }
3451
+ }
3482
3452
 
3483
3453
  // CONCATENATED MODULE: ./src/core/logger.ts
3484
3454
 
3485
3455
 
3486
- var logger_Logger = (function () {
3487
- function Logger() {
3488
- this.globalLog = function (message) {
3456
+ class logger_Logger {
3457
+ constructor() {
3458
+ this.globalLog = (message) => {
3489
3459
  if (self.console && self.console.log) {
3490
3460
  self.console.log(message);
3491
3461
  }
3492
3462
  };
3493
3463
  }
3494
- Logger.prototype.debug = function () {
3495
- var args = [];
3496
- for (var _i = 0; _i < arguments.length; _i++) {
3497
- args[_i] = arguments[_i];
3498
- }
3464
+ debug(...args) {
3499
3465
  this.log(this.globalLog, args);
3500
- };
3501
- Logger.prototype.warn = function () {
3502
- var args = [];
3503
- for (var _i = 0; _i < arguments.length; _i++) {
3504
- args[_i] = arguments[_i];
3505
- }
3466
+ }
3467
+ warn(...args) {
3506
3468
  this.log(this.globalLogWarn, args);
3507
- };
3508
- Logger.prototype.error = function () {
3509
- var args = [];
3510
- for (var _i = 0; _i < arguments.length; _i++) {
3511
- args[_i] = arguments[_i];
3512
- }
3469
+ }
3470
+ error(...args) {
3513
3471
  this.log(this.globalLogError, args);
3514
- };
3515
- Logger.prototype.globalLogWarn = function (message) {
3472
+ }
3473
+ globalLogWarn(message) {
3516
3474
  if (self.console && self.console.warn) {
3517
3475
  self.console.warn(message);
3518
3476
  }
3519
3477
  else {
3520
3478
  this.globalLog(message);
3521
3479
  }
3522
- };
3523
- Logger.prototype.globalLogError = function (message) {
3480
+ }
3481
+ globalLogError(message) {
3524
3482
  if (self.console && self.console.error) {
3525
3483
  self.console.error(message);
3526
3484
  }
3527
3485
  else {
3528
3486
  this.globalLogWarn(message);
3529
3487
  }
3530
- };
3531
- Logger.prototype.log = function (defaultLoggingFunction) {
3532
- var args = [];
3533
- for (var _i = 1; _i < arguments.length; _i++) {
3534
- args[_i - 1] = arguments[_i];
3535
- }
3488
+ }
3489
+ log(defaultLoggingFunction, ...args) {
3536
3490
  var message = stringify.apply(this, arguments);
3537
3491
  if (core_pusher.log) {
3538
3492
  core_pusher.log(message);
3539
3493
  }
3540
3494
  else if (core_pusher.logToConsole) {
3541
- var log = defaultLoggingFunction.bind(this);
3495
+ const log = defaultLoggingFunction.bind(this);
3542
3496
  log(message);
3543
3497
  }
3544
- };
3545
- return Logger;
3546
- }());
3498
+ }
3499
+ }
3547
3500
  /* harmony default export */ var logger = (new logger_Logger());
3548
3501
 
3549
3502
  // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
3550
- var transport_connection_extends = (undefined && undefined.__extends) || (function () {
3551
- var extendStatics = function (d, b) {
3552
- extendStatics = Object.setPrototypeOf ||
3553
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3554
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3555
- return extendStatics(d, b);
3556
- };
3557
- return function (d, b) {
3558
- extendStatics(d, b);
3559
- function __() { this.constructor = d; }
3560
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3561
- };
3562
- })();
3563
3503
 
3564
3504
 
3565
3505
 
3566
3506
 
3567
3507
 
3568
- var transport_connection_TransportConnection = (function (_super) {
3569
- transport_connection_extends(TransportConnection, _super);
3570
- function TransportConnection(hooks, name, priority, key, options) {
3571
- var _this = _super.call(this) || this;
3572
- _this.initialize = worker_runtime.transportConnectionInitializer;
3573
- _this.hooks = hooks;
3574
- _this.name = name;
3575
- _this.priority = priority;
3576
- _this.key = key;
3577
- _this.options = options;
3578
- _this.state = 'new';
3579
- _this.timeline = options.timeline;
3580
- _this.activityTimeout = options.activityTimeout;
3581
- _this.id = _this.timeline.generateUniqueID();
3582
- return _this;
3508
+ class transport_connection_TransportConnection extends dispatcher_Dispatcher {
3509
+ constructor(hooks, name, priority, key, options) {
3510
+ super();
3511
+ this.initialize = worker_runtime.transportConnectionInitializer;
3512
+ this.hooks = hooks;
3513
+ this.name = name;
3514
+ this.priority = priority;
3515
+ this.key = key;
3516
+ this.options = options;
3517
+ this.state = 'new';
3518
+ this.timeline = options.timeline;
3519
+ this.activityTimeout = options.activityTimeout;
3520
+ this.id = this.timeline.generateUniqueID();
3583
3521
  }
3584
- TransportConnection.prototype.handlesActivityChecks = function () {
3522
+ handlesActivityChecks() {
3585
3523
  return Boolean(this.hooks.handlesActivityChecks);
3586
- };
3587
- TransportConnection.prototype.supportsPing = function () {
3524
+ }
3525
+ supportsPing() {
3588
3526
  return Boolean(this.hooks.supportsPing);
3589
- };
3590
- TransportConnection.prototype.connect = function () {
3591
- var _this = this;
3527
+ }
3528
+ connect() {
3592
3529
  if (this.socket || this.state !== 'initialized') {
3593
3530
  return false;
3594
3531
  }
@@ -3597,18 +3534,18 @@ var transport_connection_TransportConnection = (function (_super) {
3597
3534
  this.socket = this.hooks.getSocket(url, this.options);
3598
3535
  }
3599
3536
  catch (e) {
3600
- util.defer(function () {
3601
- _this.onError(e);
3602
- _this.changeState('closed');
3537
+ util.defer(() => {
3538
+ this.onError(e);
3539
+ this.changeState('closed');
3603
3540
  });
3604
3541
  return false;
3605
3542
  }
3606
3543
  this.bindListeners();
3607
- logger.debug('Connecting', { transport: this.name, url: url });
3544
+ logger.debug('Connecting', { transport: this.name, url });
3608
3545
  this.changeState('connecting');
3609
3546
  return true;
3610
- };
3611
- TransportConnection.prototype.close = function () {
3547
+ }
3548
+ close() {
3612
3549
  if (this.socket) {
3613
3550
  this.socket.close();
3614
3551
  return true;
@@ -3616,13 +3553,12 @@ var transport_connection_TransportConnection = (function (_super) {
3616
3553
  else {
3617
3554
  return false;
3618
3555
  }
3619
- };
3620
- TransportConnection.prototype.send = function (data) {
3621
- var _this = this;
3556
+ }
3557
+ send(data) {
3622
3558
  if (this.state === 'open') {
3623
- util.defer(function () {
3624
- if (_this.socket) {
3625
- _this.socket.send(data);
3559
+ util.defer(() => {
3560
+ if (this.socket) {
3561
+ this.socket.send(data);
3626
3562
  }
3627
3563
  });
3628
3564
  return true;
@@ -3630,24 +3566,24 @@ var transport_connection_TransportConnection = (function (_super) {
3630
3566
  else {
3631
3567
  return false;
3632
3568
  }
3633
- };
3634
- TransportConnection.prototype.ping = function () {
3569
+ }
3570
+ ping() {
3635
3571
  if (this.state === 'open' && this.supportsPing()) {
3636
3572
  this.socket.ping();
3637
3573
  }
3638
- };
3639
- TransportConnection.prototype.onOpen = function () {
3574
+ }
3575
+ onOpen() {
3640
3576
  if (this.hooks.beforeOpen) {
3641
3577
  this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
3642
3578
  }
3643
3579
  this.changeState('open');
3644
3580
  this.socket.onopen = undefined;
3645
- };
3646
- TransportConnection.prototype.onError = function (error) {
3581
+ }
3582
+ onError(error) {
3647
3583
  this.emit('error', { type: 'WebSocketError', error: error });
3648
3584
  this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
3649
- };
3650
- TransportConnection.prototype.onClose = function (closeEvent) {
3585
+ }
3586
+ onClose(closeEvent) {
3651
3587
  if (closeEvent) {
3652
3588
  this.changeState('closed', {
3653
3589
  code: closeEvent.code,
@@ -3660,34 +3596,33 @@ var transport_connection_TransportConnection = (function (_super) {
3660
3596
  }
3661
3597
  this.unbindListeners();
3662
3598
  this.socket = undefined;
3663
- };
3664
- TransportConnection.prototype.onMessage = function (message) {
3599
+ }
3600
+ onMessage(message) {
3665
3601
  this.emit('message', message);
3666
- };
3667
- TransportConnection.prototype.onActivity = function () {
3602
+ }
3603
+ onActivity() {
3668
3604
  this.emit('activity');
3669
- };
3670
- TransportConnection.prototype.bindListeners = function () {
3671
- var _this = this;
3672
- this.socket.onopen = function () {
3673
- _this.onOpen();
3605
+ }
3606
+ bindListeners() {
3607
+ this.socket.onopen = () => {
3608
+ this.onOpen();
3674
3609
  };
3675
- this.socket.onerror = function (error) {
3676
- _this.onError(error);
3610
+ this.socket.onerror = error => {
3611
+ this.onError(error);
3677
3612
  };
3678
- this.socket.onclose = function (closeEvent) {
3679
- _this.onClose(closeEvent);
3613
+ this.socket.onclose = closeEvent => {
3614
+ this.onClose(closeEvent);
3680
3615
  };
3681
- this.socket.onmessage = function (message) {
3682
- _this.onMessage(message);
3616
+ this.socket.onmessage = message => {
3617
+ this.onMessage(message);
3683
3618
  };
3684
3619
  if (this.supportsPing()) {
3685
- this.socket.onactivity = function () {
3686
- _this.onActivity();
3620
+ this.socket.onactivity = () => {
3621
+ this.onActivity();
3687
3622
  };
3688
3623
  }
3689
- };
3690
- TransportConnection.prototype.unbindListeners = function () {
3624
+ }
3625
+ unbindListeners() {
3691
3626
  if (this.socket) {
3692
3627
  this.socket.onopen = undefined;
3693
3628
  this.socket.onerror = undefined;
@@ -3697,44 +3632,40 @@ var transport_connection_TransportConnection = (function (_super) {
3697
3632
  this.socket.onactivity = undefined;
3698
3633
  }
3699
3634
  }
3700
- };
3701
- TransportConnection.prototype.changeState = function (state, params) {
3635
+ }
3636
+ changeState(state, params) {
3702
3637
  this.state = state;
3703
3638
  this.timeline.info(this.buildTimelineMessage({
3704
3639
  state: state,
3705
3640
  params: params
3706
3641
  }));
3707
3642
  this.emit(state, params);
3708
- };
3709
- TransportConnection.prototype.buildTimelineMessage = function (message) {
3643
+ }
3644
+ buildTimelineMessage(message) {
3710
3645
  return extend({ cid: this.id }, message);
3711
- };
3712
- return TransportConnection;
3713
- }(dispatcher));
3714
- /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
3646
+ }
3647
+ }
3715
3648
 
3716
3649
  // CONCATENATED MODULE: ./src/core/transports/transport.ts
3717
3650
 
3718
- var transport_Transport = (function () {
3719
- function Transport(hooks) {
3651
+ class transport_Transport {
3652
+ constructor(hooks) {
3720
3653
  this.hooks = hooks;
3721
3654
  }
3722
- Transport.prototype.isSupported = function (environment) {
3655
+ isSupported(environment) {
3723
3656
  return this.hooks.isSupported(environment);
3724
- };
3725
- Transport.prototype.createConnection = function (name, priority, key, options) {
3726
- return new transport_connection(this.hooks, name, priority, key, options);
3727
- };
3728
- return Transport;
3729
- }());
3730
- /* harmony default export */ var transports_transport = (transport_Transport);
3657
+ }
3658
+ createConnection(name, priority, key, options) {
3659
+ return new transport_connection_TransportConnection(this.hooks, name, priority, key, options);
3660
+ }
3661
+ }
3731
3662
 
3732
3663
  // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
3733
3664
 
3734
3665
 
3735
3666
 
3736
3667
 
3737
- var WSTransport = new transports_transport({
3668
+ var WSTransport = new transport_Transport({
3738
3669
  urls: ws,
3739
3670
  handlesActivityChecks: false,
3740
3671
  supportsPing: false,
@@ -3771,8 +3702,8 @@ var xhrConfiguration = {
3771
3702
  return worker_runtime.isXHRSupported();
3772
3703
  }
3773
3704
  };
3774
- var XHRStreamingTransport = new transports_transport((extend({}, streamingConfiguration, xhrConfiguration)));
3775
- var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
3705
+ var XHRStreamingTransport = new transport_Transport((extend({}, streamingConfiguration, xhrConfiguration)));
3706
+ var XHRPollingTransport = new transport_Transport(extend({}, pollingConfiguration, xhrConfiguration));
3776
3707
  var Transports = {
3777
3708
  ws: WSTransport,
3778
3709
  xhr_streaming: XHRStreamingTransport,
@@ -3783,16 +3714,15 @@ var Transports = {
3783
3714
  // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
3784
3715
 
3785
3716
 
3786
- var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
3787
- function AssistantToTheTransportManager(manager, transport, options) {
3717
+ class assistant_to_the_transport_manager_AssistantToTheTransportManager {
3718
+ constructor(manager, transport, options) {
3788
3719
  this.manager = manager;
3789
3720
  this.transport = transport;
3790
3721
  this.minPingDelay = options.minPingDelay;
3791
3722
  this.maxPingDelay = options.maxPingDelay;
3792
3723
  this.pingDelay = undefined;
3793
3724
  }
3794
- AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
3795
- var _this = this;
3725
+ createConnection(name, priority, key, options) {
3796
3726
  options = extend({}, options, {
3797
3727
  activityTimeout: this.pingDelay
3798
3728
  });
@@ -3803,31 +3733,29 @@ var assistant_to_the_transport_manager_AssistantToTheTransportManager = (functio
3803
3733
  connection.bind('closed', onClosed);
3804
3734
  openTimestamp = util.now();
3805
3735
  };
3806
- var onClosed = function (closeEvent) {
3736
+ var onClosed = closeEvent => {
3807
3737
  connection.unbind('closed', onClosed);
3808
3738
  if (closeEvent.code === 1002 || closeEvent.code === 1003) {
3809
- _this.manager.reportDeath();
3739
+ this.manager.reportDeath();
3810
3740
  }
3811
3741
  else if (!closeEvent.wasClean && openTimestamp) {
3812
3742
  var lifespan = util.now() - openTimestamp;
3813
- if (lifespan < 2 * _this.maxPingDelay) {
3814
- _this.manager.reportDeath();
3815
- _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
3743
+ if (lifespan < 2 * this.maxPingDelay) {
3744
+ this.manager.reportDeath();
3745
+ this.pingDelay = Math.max(lifespan / 2, this.minPingDelay);
3816
3746
  }
3817
3747
  }
3818
3748
  };
3819
3749
  connection.bind('open', onOpen);
3820
3750
  return connection;
3821
- };
3822
- AssistantToTheTransportManager.prototype.isSupported = function (environment) {
3751
+ }
3752
+ isSupported(environment) {
3823
3753
  return this.manager.isAlive() && this.transport.isSupported(environment);
3824
- };
3825
- return AssistantToTheTransportManager;
3826
- }());
3827
- /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
3754
+ }
3755
+ }
3828
3756
 
3829
3757
  // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
3830
- var Protocol = {
3758
+ const Protocol = {
3831
3759
  decodeMessage: function (messageEvent) {
3832
3760
  try {
3833
3761
  var messageData = JSON.parse(messageEvent.data);
@@ -3920,68 +3848,52 @@ var Protocol = {
3920
3848
  /* harmony default export */ var protocol = (Protocol);
3921
3849
 
3922
3850
  // CONCATENATED MODULE: ./src/core/connection/connection.ts
3923
- var connection_extends = (undefined && undefined.__extends) || (function () {
3924
- var extendStatics = function (d, b) {
3925
- extendStatics = Object.setPrototypeOf ||
3926
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3927
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3928
- return extendStatics(d, b);
3929
- };
3930
- return function (d, b) {
3931
- extendStatics(d, b);
3932
- function __() { this.constructor = d; }
3933
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3934
- };
3935
- })();
3936
3851
 
3937
3852
 
3938
3853
 
3939
3854
 
3940
- var connection_Connection = (function (_super) {
3941
- connection_extends(Connection, _super);
3942
- function Connection(id, transport) {
3943
- var _this = _super.call(this) || this;
3944
- _this.id = id;
3945
- _this.transport = transport;
3946
- _this.activityTimeout = transport.activityTimeout;
3947
- _this.bindListeners();
3948
- return _this;
3855
+ class connection_Connection extends dispatcher_Dispatcher {
3856
+ constructor(id, transport) {
3857
+ super();
3858
+ this.id = id;
3859
+ this.transport = transport;
3860
+ this.activityTimeout = transport.activityTimeout;
3861
+ this.bindListeners();
3949
3862
  }
3950
- Connection.prototype.handlesActivityChecks = function () {
3863
+ handlesActivityChecks() {
3951
3864
  return this.transport.handlesActivityChecks();
3952
- };
3953
- Connection.prototype.send = function (data) {
3865
+ }
3866
+ send(data) {
3954
3867
  return this.transport.send(data);
3955
- };
3956
- Connection.prototype.send_event = function (name, data, channel) {
3868
+ }
3869
+ send_event(name, data, channel) {
3957
3870
  var event = { event: name, data: data };
3958
3871
  if (channel) {
3959
3872
  event.channel = channel;
3960
3873
  }
3961
3874
  logger.debug('Event sent', event);
3962
3875
  return this.send(protocol.encodeMessage(event));
3963
- };
3964
- Connection.prototype.ping = function () {
3876
+ }
3877
+ ping() {
3965
3878
  if (this.transport.supportsPing()) {
3966
3879
  this.transport.ping();
3967
3880
  }
3968
3881
  else {
3969
3882
  this.send_event('pusher:ping', {});
3970
3883
  }
3971
- };
3972
- Connection.prototype.close = function () {
3884
+ }
3885
+ close() {
3973
3886
  this.transport.close();
3974
- };
3975
- Connection.prototype.bindListeners = function () {
3976
- var _this = this;
3887
+ }
3888
+ bindListeners() {
3977
3889
  var listeners = {
3978
- message: function (messageEvent) {
3890
+ message: (messageEvent) => {
3979
3891
  var pusherEvent;
3980
3892
  try {
3981
3893
  pusherEvent = protocol.decodeMessage(messageEvent);
3982
3894
  }
3983
3895
  catch (e) {
3984
- _this.emit('error', {
3896
+ this.emit('error', {
3985
3897
  type: 'MessageParseError',
3986
3898
  error: e,
3987
3899
  data: messageEvent.data
@@ -3991,46 +3903,46 @@ var connection_Connection = (function (_super) {
3991
3903
  logger.debug('Event recd', pusherEvent);
3992
3904
  switch (pusherEvent.event) {
3993
3905
  case 'pusher:error':
3994
- _this.emit('error', {
3906
+ this.emit('error', {
3995
3907
  type: 'PusherError',
3996
3908
  data: pusherEvent.data
3997
3909
  });
3998
3910
  break;
3999
3911
  case 'pusher:ping':
4000
- _this.emit('ping');
3912
+ this.emit('ping');
4001
3913
  break;
4002
3914
  case 'pusher:pong':
4003
- _this.emit('pong');
3915
+ this.emit('pong');
4004
3916
  break;
4005
3917
  }
4006
- _this.emit('message', pusherEvent);
3918
+ this.emit('message', pusherEvent);
4007
3919
  }
4008
3920
  },
4009
- activity: function () {
4010
- _this.emit('activity');
3921
+ activity: () => {
3922
+ this.emit('activity');
4011
3923
  },
4012
- error: function (error) {
4013
- _this.emit('error', error);
3924
+ error: error => {
3925
+ this.emit('error', error);
4014
3926
  },
4015
- closed: function (closeEvent) {
3927
+ closed: closeEvent => {
4016
3928
  unbindListeners();
4017
3929
  if (closeEvent && closeEvent.code) {
4018
- _this.handleCloseEvent(closeEvent);
3930
+ this.handleCloseEvent(closeEvent);
4019
3931
  }
4020
- _this.transport = null;
4021
- _this.emit('closed');
3932
+ this.transport = null;
3933
+ this.emit('closed');
4022
3934
  }
4023
3935
  };
4024
- var unbindListeners = function () {
4025
- objectApply(listeners, function (listener, event) {
4026
- _this.transport.unbind(event, listener);
3936
+ var unbindListeners = () => {
3937
+ objectApply(listeners, (listener, event) => {
3938
+ this.transport.unbind(event, listener);
4027
3939
  });
4028
3940
  };
4029
- objectApply(listeners, function (listener, event) {
4030
- _this.transport.bind(event, listener);
3941
+ objectApply(listeners, (listener, event) => {
3942
+ this.transport.bind(event, listener);
4031
3943
  });
4032
- };
4033
- Connection.prototype.handleCloseEvent = function (closeEvent) {
3944
+ }
3945
+ handleCloseEvent(closeEvent) {
4034
3946
  var action = protocol.getCloseAction(closeEvent);
4035
3947
  var error = protocol.getCloseError(closeEvent);
4036
3948
  if (error) {
@@ -4039,203 +3951,138 @@ var connection_Connection = (function (_super) {
4039
3951
  if (action) {
4040
3952
  this.emit(action, { action: action, error: error });
4041
3953
  }
4042
- };
4043
- return Connection;
4044
- }(dispatcher));
4045
- /* harmony default export */ var connection_connection = (connection_Connection);
3954
+ }
3955
+ }
4046
3956
 
4047
3957
  // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
4048
3958
 
4049
3959
 
4050
3960
 
4051
- var handshake_Handshake = (function () {
4052
- function Handshake(transport, callback) {
3961
+ class handshake_Handshake {
3962
+ constructor(transport, callback) {
4053
3963
  this.transport = transport;
4054
3964
  this.callback = callback;
4055
3965
  this.bindListeners();
4056
3966
  }
4057
- Handshake.prototype.close = function () {
3967
+ close() {
4058
3968
  this.unbindListeners();
4059
3969
  this.transport.close();
4060
- };
4061
- Handshake.prototype.bindListeners = function () {
4062
- var _this = this;
4063
- this.onMessage = function (m) {
4064
- _this.unbindListeners();
3970
+ }
3971
+ bindListeners() {
3972
+ this.onMessage = m => {
3973
+ this.unbindListeners();
4065
3974
  var result;
4066
3975
  try {
4067
3976
  result = protocol.processHandshake(m);
4068
3977
  }
4069
3978
  catch (e) {
4070
- _this.finish('error', { error: e });
4071
- _this.transport.close();
3979
+ this.finish('error', { error: e });
3980
+ this.transport.close();
4072
3981
  return;
4073
3982
  }
4074
3983
  if (result.action === 'connected') {
4075
- _this.finish('connected', {
4076
- connection: new connection_connection(result.id, _this.transport),
3984
+ this.finish('connected', {
3985
+ connection: new connection_Connection(result.id, this.transport),
4077
3986
  activityTimeout: result.activityTimeout
4078
3987
  });
4079
3988
  }
4080
3989
  else {
4081
- _this.finish(result.action, { error: result.error });
4082
- _this.transport.close();
3990
+ this.finish(result.action, { error: result.error });
3991
+ this.transport.close();
4083
3992
  }
4084
3993
  };
4085
- this.onClosed = function (closeEvent) {
4086
- _this.unbindListeners();
3994
+ this.onClosed = closeEvent => {
3995
+ this.unbindListeners();
4087
3996
  var action = protocol.getCloseAction(closeEvent) || 'backoff';
4088
3997
  var error = protocol.getCloseError(closeEvent);
4089
- _this.finish(action, { error: error });
3998
+ this.finish(action, { error: error });
4090
3999
  };
4091
4000
  this.transport.bind('message', this.onMessage);
4092
4001
  this.transport.bind('closed', this.onClosed);
4093
- };
4094
- Handshake.prototype.unbindListeners = function () {
4002
+ }
4003
+ unbindListeners() {
4095
4004
  this.transport.unbind('message', this.onMessage);
4096
4005
  this.transport.unbind('closed', this.onClosed);
4097
- };
4098
- Handshake.prototype.finish = function (action, params) {
4006
+ }
4007
+ finish(action, params) {
4099
4008
  this.callback(extend({ transport: this.transport, action: action }, params));
4100
- };
4101
- return Handshake;
4102
- }());
4103
- /* harmony default export */ var connection_handshake = (handshake_Handshake);
4009
+ }
4010
+ }
4104
4011
 
4105
4012
  // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
4106
4013
 
4107
- var timeline_sender_TimelineSender = (function () {
4108
- function TimelineSender(timeline, options) {
4014
+ class timeline_sender_TimelineSender {
4015
+ constructor(timeline, options) {
4109
4016
  this.timeline = timeline;
4110
4017
  this.options = options || {};
4111
4018
  }
4112
- TimelineSender.prototype.send = function (useTLS, callback) {
4019
+ send(useTLS, callback) {
4113
4020
  if (this.timeline.isEmpty()) {
4114
4021
  return;
4115
4022
  }
4116
4023
  this.timeline.send(worker_runtime.TimelineTransport.getAgent(this, useTLS), callback);
4117
- };
4118
- return TimelineSender;
4119
- }());
4120
- /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
4024
+ }
4025
+ }
4121
4026
 
4122
4027
  // CONCATENATED MODULE: ./src/core/errors.ts
4123
- var errors_extends = (undefined && undefined.__extends) || (function () {
4124
- var extendStatics = function (d, b) {
4125
- extendStatics = Object.setPrototypeOf ||
4126
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4127
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4128
- return extendStatics(d, b);
4129
- };
4130
- return function (d, b) {
4131
- extendStatics(d, b);
4132
- function __() { this.constructor = d; }
4133
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4134
- };
4135
- })();
4136
- var BadEventName = (function (_super) {
4137
- errors_extends(BadEventName, _super);
4138
- function BadEventName(msg) {
4139
- var _newTarget = this.constructor;
4140
- var _this = _super.call(this, msg) || this;
4141
- Object.setPrototypeOf(_this, _newTarget.prototype);
4142
- return _this;
4143
- }
4144
- return BadEventName;
4145
- }(Error));
4146
-
4147
- var BadChannelName = (function (_super) {
4148
- errors_extends(BadChannelName, _super);
4149
- function BadChannelName(msg) {
4150
- var _newTarget = this.constructor;
4151
- var _this = _super.call(this, msg) || this;
4152
- Object.setPrototypeOf(_this, _newTarget.prototype);
4153
- return _this;
4154
- }
4155
- return BadChannelName;
4156
- }(Error));
4157
-
4158
- var RequestTimedOut = (function (_super) {
4159
- errors_extends(RequestTimedOut, _super);
4160
- function RequestTimedOut(msg) {
4161
- var _newTarget = this.constructor;
4162
- var _this = _super.call(this, msg) || this;
4163
- Object.setPrototypeOf(_this, _newTarget.prototype);
4164
- return _this;
4165
- }
4166
- return RequestTimedOut;
4167
- }(Error));
4168
-
4169
- var TransportPriorityTooLow = (function (_super) {
4170
- errors_extends(TransportPriorityTooLow, _super);
4171
- function TransportPriorityTooLow(msg) {
4172
- var _newTarget = this.constructor;
4173
- var _this = _super.call(this, msg) || this;
4174
- Object.setPrototypeOf(_this, _newTarget.prototype);
4175
- return _this;
4176
- }
4177
- return TransportPriorityTooLow;
4178
- }(Error));
4179
-
4180
- var TransportClosed = (function (_super) {
4181
- errors_extends(TransportClosed, _super);
4182
- function TransportClosed(msg) {
4183
- var _newTarget = this.constructor;
4184
- var _this = _super.call(this, msg) || this;
4185
- Object.setPrototypeOf(_this, _newTarget.prototype);
4186
- return _this;
4187
- }
4188
- return TransportClosed;
4189
- }(Error));
4190
-
4191
- var UnsupportedFeature = (function (_super) {
4192
- errors_extends(UnsupportedFeature, _super);
4193
- function UnsupportedFeature(msg) {
4194
- var _newTarget = this.constructor;
4195
- var _this = _super.call(this, msg) || this;
4196
- Object.setPrototypeOf(_this, _newTarget.prototype);
4197
- return _this;
4198
- }
4199
- return UnsupportedFeature;
4200
- }(Error));
4201
-
4202
- var UnsupportedTransport = (function (_super) {
4203
- errors_extends(UnsupportedTransport, _super);
4204
- function UnsupportedTransport(msg) {
4205
- var _newTarget = this.constructor;
4206
- var _this = _super.call(this, msg) || this;
4207
- Object.setPrototypeOf(_this, _newTarget.prototype);
4208
- return _this;
4209
- }
4210
- return UnsupportedTransport;
4211
- }(Error));
4212
-
4213
- var UnsupportedStrategy = (function (_super) {
4214
- errors_extends(UnsupportedStrategy, _super);
4215
- function UnsupportedStrategy(msg) {
4216
- var _newTarget = this.constructor;
4217
- var _this = _super.call(this, msg) || this;
4218
- Object.setPrototypeOf(_this, _newTarget.prototype);
4219
- return _this;
4220
- }
4221
- return UnsupportedStrategy;
4222
- }(Error));
4223
-
4224
- var HTTPAuthError = (function (_super) {
4225
- errors_extends(HTTPAuthError, _super);
4226
- function HTTPAuthError(status, msg) {
4227
- var _newTarget = this.constructor;
4228
- var _this = _super.call(this, msg) || this;
4229
- _this.status = status;
4230
- Object.setPrototypeOf(_this, _newTarget.prototype);
4231
- return _this;
4232
- }
4233
- return HTTPAuthError;
4234
- }(Error));
4235
-
4028
+ class BadEventName extends Error {
4029
+ constructor(msg) {
4030
+ super(msg);
4031
+ Object.setPrototypeOf(this, new.target.prototype);
4032
+ }
4033
+ }
4034
+ class BadChannelName extends Error {
4035
+ constructor(msg) {
4036
+ super(msg);
4037
+ Object.setPrototypeOf(this, new.target.prototype);
4038
+ }
4039
+ }
4040
+ class RequestTimedOut extends Error {
4041
+ constructor(msg) {
4042
+ super(msg);
4043
+ Object.setPrototypeOf(this, new.target.prototype);
4044
+ }
4045
+ }
4046
+ class TransportPriorityTooLow extends Error {
4047
+ constructor(msg) {
4048
+ super(msg);
4049
+ Object.setPrototypeOf(this, new.target.prototype);
4050
+ }
4051
+ }
4052
+ class TransportClosed extends Error {
4053
+ constructor(msg) {
4054
+ super(msg);
4055
+ Object.setPrototypeOf(this, new.target.prototype);
4056
+ }
4057
+ }
4058
+ class UnsupportedFeature extends Error {
4059
+ constructor(msg) {
4060
+ super(msg);
4061
+ Object.setPrototypeOf(this, new.target.prototype);
4062
+ }
4063
+ }
4064
+ class UnsupportedTransport extends Error {
4065
+ constructor(msg) {
4066
+ super(msg);
4067
+ Object.setPrototypeOf(this, new.target.prototype);
4068
+ }
4069
+ }
4070
+ class UnsupportedStrategy extends Error {
4071
+ constructor(msg) {
4072
+ super(msg);
4073
+ Object.setPrototypeOf(this, new.target.prototype);
4074
+ }
4075
+ }
4076
+ class HTTPAuthError extends Error {
4077
+ constructor(status, msg) {
4078
+ super(msg);
4079
+ this.status = status;
4080
+ Object.setPrototypeOf(this, new.target.prototype);
4081
+ }
4082
+ }
4236
4083
 
4237
4084
  // CONCATENATED MODULE: ./src/core/utils/url_store.ts
4238
- var urlStore = {
4085
+ const urlStore = {
4239
4086
  baseUrl: 'https://pusher.com',
4240
4087
  urls: {
4241
4088
  authenticationEndpoint: {
@@ -4255,12 +4102,12 @@ var urlStore = {
4255
4102
  }
4256
4103
  }
4257
4104
  };
4258
- var buildLogSuffix = function (key) {
4259
- var urlPrefix = 'See:';
4260
- var urlObj = urlStore.urls[key];
4105
+ const buildLogSuffix = function (key) {
4106
+ const urlPrefix = 'See:';
4107
+ const urlObj = urlStore.urls[key];
4261
4108
  if (!urlObj)
4262
4109
  return '';
4263
- var url;
4110
+ let url;
4264
4111
  if (urlObj.fullUrl) {
4265
4112
  url = urlObj.fullUrl;
4266
4113
  }
@@ -4269,60 +4116,45 @@ var buildLogSuffix = function (key) {
4269
4116
  }
4270
4117
  if (!url)
4271
4118
  return '';
4272
- return urlPrefix + " " + url;
4119
+ return `${urlPrefix} ${url}`;
4273
4120
  };
4274
- /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
4121
+ /* harmony default export */ var url_store = ({ buildLogSuffix });
4275
4122
 
4276
4123
  // CONCATENATED MODULE: ./src/core/channels/channel.ts
4277
- var channel_extends = (undefined && undefined.__extends) || (function () {
4278
- var extendStatics = function (d, b) {
4279
- extendStatics = Object.setPrototypeOf ||
4280
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4281
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4282
- return extendStatics(d, b);
4283
- };
4284
- return function (d, b) {
4285
- extendStatics(d, b);
4286
- function __() { this.constructor = d; }
4287
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4288
- };
4289
- })();
4290
4124
 
4291
4125
 
4292
4126
 
4293
4127
 
4294
4128
 
4295
- var channel_Channel = (function (_super) {
4296
- channel_extends(Channel, _super);
4297
- function Channel(name, pusher) {
4298
- var _this = _super.call(this, function (event, data) {
4129
+ class channel_Channel extends dispatcher_Dispatcher {
4130
+ constructor(name, pusher) {
4131
+ super(function (event, data) {
4299
4132
  logger.debug('No callbacks on ' + name + ' for ' + event);
4300
- }) || this;
4301
- _this.name = name;
4302
- _this.pusher = pusher;
4303
- _this.subscribed = false;
4304
- _this.subscriptionPending = false;
4305
- _this.subscriptionCancelled = false;
4306
- return _this;
4307
- }
4308
- Channel.prototype.authorize = function (socketId, callback) {
4133
+ });
4134
+ this.name = name;
4135
+ this.pusher = pusher;
4136
+ this.subscribed = false;
4137
+ this.subscriptionPending = false;
4138
+ this.subscriptionCancelled = false;
4139
+ }
4140
+ authorize(socketId, callback) {
4309
4141
  return callback(null, { auth: '' });
4310
- };
4311
- Channel.prototype.trigger = function (event, data) {
4142
+ }
4143
+ trigger(event, data) {
4312
4144
  if (event.indexOf('client-') !== 0) {
4313
4145
  throw new BadEventName("Event '" + event + "' does not start with 'client-'");
4314
4146
  }
4315
4147
  if (!this.subscribed) {
4316
4148
  var suffix = url_store.buildLogSuffix('triggeringClientEvents');
4317
- logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
4149
+ logger.warn(`Client event triggered before channel 'subscription_succeeded' event . ${suffix}`);
4318
4150
  }
4319
4151
  return this.pusher.send_event(event, data, this.name);
4320
- };
4321
- Channel.prototype.disconnect = function () {
4152
+ }
4153
+ disconnect() {
4322
4154
  this.subscribed = false;
4323
4155
  this.subscriptionPending = false;
4324
- };
4325
- Channel.prototype.handleEvent = function (event) {
4156
+ }
4157
+ handleEvent(event) {
4326
4158
  var eventName = event.event;
4327
4159
  var data = event.data;
4328
4160
  if (eventName === 'pusher_internal:subscription_succeeded') {
@@ -4335,8 +4167,8 @@ var channel_Channel = (function (_super) {
4335
4167
  var metadata = {};
4336
4168
  this.emit(eventName, data, metadata);
4337
4169
  }
4338
- };
4339
- Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
4170
+ }
4171
+ handleSubscriptionSucceededEvent(event) {
4340
4172
  this.subscriptionPending = false;
4341
4173
  this.subscribed = true;
4342
4174
  if (this.subscriptionCancelled) {
@@ -4345,91 +4177,69 @@ var channel_Channel = (function (_super) {
4345
4177
  else {
4346
4178
  this.emit('pusher:subscription_succeeded', event.data);
4347
4179
  }
4348
- };
4349
- Channel.prototype.handleSubscriptionCountEvent = function (event) {
4180
+ }
4181
+ handleSubscriptionCountEvent(event) {
4350
4182
  if (event.data.subscription_count) {
4351
4183
  this.subscriptionCount = event.data.subscription_count;
4352
4184
  }
4353
4185
  this.emit('pusher:subscription_count', event.data);
4354
- };
4355
- Channel.prototype.subscribe = function () {
4356
- var _this = this;
4186
+ }
4187
+ subscribe() {
4357
4188
  if (this.subscribed) {
4358
4189
  return;
4359
4190
  }
4360
4191
  this.subscriptionPending = true;
4361
4192
  this.subscriptionCancelled = false;
4362
- this.authorize(this.pusher.connection.socket_id, function (error, data) {
4193
+ this.authorize(this.pusher.connection.socket_id, (error, data) => {
4363
4194
  if (error) {
4364
- _this.subscriptionPending = false;
4195
+ this.subscriptionPending = false;
4365
4196
  logger.error(error.toString());
4366
- _this.emit('pusher:subscription_error', Object.assign({}, {
4197
+ this.emit('pusher:subscription_error', Object.assign({}, {
4367
4198
  type: 'AuthError',
4368
4199
  error: error.message
4369
4200
  }, error instanceof HTTPAuthError ? { status: error.status } : {}));
4370
4201
  }
4371
4202
  else {
4372
- _this.pusher.send_event('pusher:subscribe', {
4203
+ this.pusher.send_event('pusher:subscribe', {
4373
4204
  auth: data.auth,
4374
4205
  channel_data: data.channel_data,
4375
- channel: _this.name
4206
+ channel: this.name
4376
4207
  });
4377
4208
  }
4378
4209
  });
4379
- };
4380
- Channel.prototype.unsubscribe = function () {
4210
+ }
4211
+ unsubscribe() {
4381
4212
  this.subscribed = false;
4382
4213
  this.pusher.send_event('pusher:unsubscribe', {
4383
4214
  channel: this.name
4384
4215
  });
4385
- };
4386
- Channel.prototype.cancelSubscription = function () {
4216
+ }
4217
+ cancelSubscription() {
4387
4218
  this.subscriptionCancelled = true;
4388
- };
4389
- Channel.prototype.reinstateSubscription = function () {
4219
+ }
4220
+ reinstateSubscription() {
4390
4221
  this.subscriptionCancelled = false;
4391
- };
4392
- return Channel;
4393
- }(dispatcher));
4394
- /* harmony default export */ var channels_channel = (channel_Channel);
4222
+ }
4223
+ }
4395
4224
 
4396
4225
  // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
4397
- var private_channel_extends = (undefined && undefined.__extends) || (function () {
4398
- var extendStatics = function (d, b) {
4399
- extendStatics = Object.setPrototypeOf ||
4400
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4401
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4402
- return extendStatics(d, b);
4403
- };
4404
- return function (d, b) {
4405
- extendStatics(d, b);
4406
- function __() { this.constructor = d; }
4407
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4408
- };
4409
- })();
4410
4226
 
4411
- var PrivateChannel = (function (_super) {
4412
- private_channel_extends(PrivateChannel, _super);
4413
- function PrivateChannel() {
4414
- return _super !== null && _super.apply(this, arguments) || this;
4415
- }
4416
- PrivateChannel.prototype.authorize = function (socketId, callback) {
4227
+ class private_channel_PrivateChannel extends channel_Channel {
4228
+ authorize(socketId, callback) {
4417
4229
  return this.pusher.config.channelAuthorizer({
4418
4230
  channelName: this.name,
4419
4231
  socketId: socketId
4420
4232
  }, callback);
4421
- };
4422
- return PrivateChannel;
4423
- }(channels_channel));
4424
- /* harmony default export */ var private_channel = (PrivateChannel);
4233
+ }
4234
+ }
4425
4235
 
4426
4236
  // CONCATENATED MODULE: ./src/core/channels/members.ts
4427
4237
 
4428
- var members_Members = (function () {
4429
- function Members() {
4238
+ class members_Members {
4239
+ constructor() {
4430
4240
  this.reset();
4431
4241
  }
4432
- Members.prototype.get = function (id) {
4242
+ get(id) {
4433
4243
  if (Object.prototype.hasOwnProperty.call(this.members, id)) {
4434
4244
  return {
4435
4245
  id: id,
@@ -4439,60 +4249,44 @@ var members_Members = (function () {
4439
4249
  else {
4440
4250
  return null;
4441
4251
  }
4442
- };
4443
- Members.prototype.each = function (callback) {
4444
- var _this = this;
4445
- objectApply(this.members, function (member, id) {
4446
- callback(_this.get(id));
4252
+ }
4253
+ each(callback) {
4254
+ objectApply(this.members, (member, id) => {
4255
+ callback(this.get(id));
4447
4256
  });
4448
- };
4449
- Members.prototype.setMyID = function (id) {
4257
+ }
4258
+ setMyID(id) {
4450
4259
  this.myID = id;
4451
- };
4452
- Members.prototype.onSubscription = function (subscriptionData) {
4260
+ }
4261
+ onSubscription(subscriptionData) {
4453
4262
  this.members = subscriptionData.presence.hash;
4454
4263
  this.count = subscriptionData.presence.count;
4455
4264
  this.me = this.get(this.myID);
4456
- };
4457
- Members.prototype.addMember = function (memberData) {
4265
+ }
4266
+ addMember(memberData) {
4458
4267
  if (this.get(memberData.user_id) === null) {
4459
4268
  this.count++;
4460
4269
  }
4461
4270
  this.members[memberData.user_id] = memberData.user_info;
4462
4271
  return this.get(memberData.user_id);
4463
- };
4464
- Members.prototype.removeMember = function (memberData) {
4272
+ }
4273
+ removeMember(memberData) {
4465
4274
  var member = this.get(memberData.user_id);
4466
4275
  if (member) {
4467
4276
  delete this.members[memberData.user_id];
4468
4277
  this.count--;
4469
4278
  }
4470
4279
  return member;
4471
- };
4472
- Members.prototype.reset = function () {
4280
+ }
4281
+ reset() {
4473
4282
  this.members = {};
4474
4283
  this.count = 0;
4475
4284
  this.myID = null;
4476
4285
  this.me = null;
4477
- };
4478
- return Members;
4479
- }());
4480
- /* harmony default export */ var members = (members_Members);
4286
+ }
4287
+ }
4481
4288
 
4482
4289
  // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
4483
- var presence_channel_extends = (undefined && undefined.__extends) || (function () {
4484
- var extendStatics = function (d, b) {
4485
- extendStatics = Object.setPrototypeOf ||
4486
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4487
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4488
- return extendStatics(d, b);
4489
- };
4490
- return function (d, b) {
4491
- extendStatics(d, b);
4492
- function __() { this.constructor = d; }
4493
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4494
- };
4495
- })();
4496
4290
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
4497
4291
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4498
4292
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -4502,80 +4296,42 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
4502
4296
  step((generator = generator.apply(thisArg, _arguments || [])).next());
4503
4297
  });
4504
4298
  };
4505
- var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
4506
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4507
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4508
- function verb(n) { return function (v) { return step([n, v]); }; }
4509
- function step(op) {
4510
- if (f) throw new TypeError("Generator is already executing.");
4511
- while (_) try {
4512
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
4513
- if (y = 0, t) op = [op[0] & 2, t.value];
4514
- switch (op[0]) {
4515
- case 0: case 1: t = op; break;
4516
- case 4: _.label++; return { value: op[1], done: false };
4517
- case 5: _.label++; y = op[1]; op = [0]; continue;
4518
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
4519
- default:
4520
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
4521
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
4522
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
4523
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
4524
- if (t[2]) _.ops.pop();
4525
- _.trys.pop(); continue;
4526
- }
4527
- op = body.call(thisArg, _);
4528
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
4529
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4530
- }
4531
- };
4532
4299
 
4533
4300
 
4534
4301
 
4535
4302
 
4536
- var presence_channel_PresenceChannel = (function (_super) {
4537
- presence_channel_extends(PresenceChannel, _super);
4538
- function PresenceChannel(name, pusher) {
4539
- var _this = _super.call(this, name, pusher) || this;
4540
- _this.members = new members();
4541
- return _this;
4542
- }
4543
- PresenceChannel.prototype.authorize = function (socketId, callback) {
4544
- var _this = this;
4545
- _super.prototype.authorize.call(this, socketId, function (error, authData) { return __awaiter(_this, void 0, void 0, function () {
4546
- var channelData, suffix;
4547
- return __generator(this, function (_a) {
4548
- switch (_a.label) {
4549
- case 0:
4550
- if (!!error) return [3, 3];
4551
- authData = authData;
4552
- if (!(authData.channel_data != null)) return [3, 1];
4553
- channelData = JSON.parse(authData.channel_data);
4554
- this.members.setMyID(channelData.user_id);
4555
- return [3, 3];
4556
- case 1: return [4, this.pusher.user.signinDonePromise];
4557
- case 2:
4558
- _a.sent();
4559
- if (this.pusher.user.user_data != null) {
4560
- this.members.setMyID(this.pusher.user.user_data.id);
4561
- }
4562
- else {
4563
- suffix = url_store.buildLogSuffix('authorizationEndpoint');
4564
- logger.error("Invalid auth response for channel '" + this.name + "', " +
4565
- ("expected 'channel_data' field. " + suffix + ", ") +
4566
- "or the user should be signed in.");
4567
- callback('Invalid auth response');
4568
- return [2];
4569
- }
4570
- _a.label = 3;
4571
- case 3:
4572
- callback(error, authData);
4573
- return [2];
4303
+ class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
4304
+ constructor(name, pusher) {
4305
+ super(name, pusher);
4306
+ this.members = new members_Members();
4307
+ }
4308
+ authorize(socketId, callback) {
4309
+ super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
4310
+ if (!error) {
4311
+ authData = authData;
4312
+ if (authData.channel_data != null) {
4313
+ var channelData = JSON.parse(authData.channel_data);
4314
+ this.members.setMyID(channelData.user_id);
4574
4315
  }
4575
- });
4576
- }); });
4577
- };
4578
- PresenceChannel.prototype.handleEvent = function (event) {
4316
+ else {
4317
+ yield this.pusher.user.signinDonePromise;
4318
+ if (this.pusher.user.user_data != null) {
4319
+ this.members.setMyID(this.pusher.user.user_data.id);
4320
+ }
4321
+ else {
4322
+ let suffix = url_store.buildLogSuffix('authorizationEndpoint');
4323
+ logger.error(`Invalid auth response for channel '${this.name}', ` +
4324
+ `expected 'channel_data' field. ${suffix}, ` +
4325
+ `or the user should be signed in.`);
4326
+ callback('Invalid auth response');
4327
+ return;
4328
+ }
4329
+ }
4330
+ }
4331
+ callback(error, authData);
4332
+ }));
4333
+ }
4334
+ handleEvent(event) {
4579
4335
  var eventName = event.event;
4580
4336
  if (eventName.indexOf('pusher_internal:') === 0) {
4581
4337
  this.handleInternalEvent(event);
@@ -4588,8 +4344,8 @@ var presence_channel_PresenceChannel = (function (_super) {
4588
4344
  }
4589
4345
  this.emit(eventName, data, metadata);
4590
4346
  }
4591
- };
4592
- PresenceChannel.prototype.handleInternalEvent = function (event) {
4347
+ }
4348
+ handleInternalEvent(event) {
4593
4349
  var eventName = event.event;
4594
4350
  var data = event.data;
4595
4351
  switch (eventName) {
@@ -4610,8 +4366,8 @@ var presence_channel_PresenceChannel = (function (_super) {
4610
4366
  }
4611
4367
  break;
4612
4368
  }
4613
- };
4614
- PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
4369
+ }
4370
+ handleSubscriptionSucceededEvent(event) {
4615
4371
  this.subscriptionPending = false;
4616
4372
  this.subscribed = true;
4617
4373
  if (this.subscriptionCancelled) {
@@ -4621,14 +4377,12 @@ var presence_channel_PresenceChannel = (function (_super) {
4621
4377
  this.members.onSubscription(event.data);
4622
4378
  this.emit('pusher:subscription_succeeded', this.members);
4623
4379
  }
4624
- };
4625
- PresenceChannel.prototype.disconnect = function () {
4380
+ }
4381
+ disconnect() {
4626
4382
  this.members.reset();
4627
- _super.prototype.disconnect.call(this);
4628
- };
4629
- return PresenceChannel;
4630
- }(private_channel));
4631
- /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
4383
+ super.disconnect();
4384
+ }
4385
+ }
4632
4386
 
4633
4387
  // EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
4634
4388
  var utf8 = __webpack_require__(1);
@@ -4637,64 +4391,47 @@ var utf8 = __webpack_require__(1);
4637
4391
  var base64 = __webpack_require__(0);
4638
4392
 
4639
4393
  // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
4640
- var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
4641
- var extendStatics = function (d, b) {
4642
- extendStatics = Object.setPrototypeOf ||
4643
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4644
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4645
- return extendStatics(d, b);
4646
- };
4647
- return function (d, b) {
4648
- extendStatics(d, b);
4649
- function __() { this.constructor = d; }
4650
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4651
- };
4652
- })();
4653
4394
 
4654
4395
 
4655
4396
 
4656
4397
 
4657
4398
 
4658
- var encrypted_channel_EncryptedChannel = (function (_super) {
4659
- encrypted_channel_extends(EncryptedChannel, _super);
4660
- function EncryptedChannel(name, pusher, nacl) {
4661
- var _this = _super.call(this, name, pusher) || this;
4662
- _this.key = null;
4663
- _this.nacl = nacl;
4664
- return _this;
4399
+ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel {
4400
+ constructor(name, pusher, nacl) {
4401
+ super(name, pusher);
4402
+ this.key = null;
4403
+ this.nacl = nacl;
4665
4404
  }
4666
- EncryptedChannel.prototype.authorize = function (socketId, callback) {
4667
- var _this = this;
4668
- _super.prototype.authorize.call(this, socketId, function (error, authData) {
4405
+ authorize(socketId, callback) {
4406
+ super.authorize(socketId, (error, authData) => {
4669
4407
  if (error) {
4670
4408
  callback(error, authData);
4671
4409
  return;
4672
4410
  }
4673
- var sharedSecret = authData['shared_secret'];
4411
+ let sharedSecret = authData['shared_secret'];
4674
4412
  if (!sharedSecret) {
4675
- callback(new Error("No shared_secret key in auth payload for encrypted channel: " + _this.name), null);
4413
+ callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
4676
4414
  return;
4677
4415
  }
4678
- _this.key = Object(base64["decode"])(sharedSecret);
4416
+ this.key = Object(base64["decode"])(sharedSecret);
4679
4417
  delete authData['shared_secret'];
4680
4418
  callback(null, authData);
4681
4419
  });
4682
- };
4683
- EncryptedChannel.prototype.trigger = function (event, data) {
4420
+ }
4421
+ trigger(event, data) {
4684
4422
  throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
4685
- };
4686
- EncryptedChannel.prototype.handleEvent = function (event) {
4423
+ }
4424
+ handleEvent(event) {
4687
4425
  var eventName = event.event;
4688
4426
  var data = event.data;
4689
4427
  if (eventName.indexOf('pusher_internal:') === 0 ||
4690
4428
  eventName.indexOf('pusher:') === 0) {
4691
- _super.prototype.handleEvent.call(this, event);
4429
+ super.handleEvent(event);
4692
4430
  return;
4693
4431
  }
4694
4432
  this.handleEncryptedEvent(eventName, data);
4695
- };
4696
- EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
4697
- var _this = this;
4433
+ }
4434
+ handleEncryptedEvent(event, data) {
4698
4435
  if (!this.key) {
4699
4436
  logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
4700
4437
  return;
@@ -4704,98 +4441,81 @@ var encrypted_channel_EncryptedChannel = (function (_super) {
4704
4441
  data);
4705
4442
  return;
4706
4443
  }
4707
- var cipherText = Object(base64["decode"])(data.ciphertext);
4444
+ let cipherText = Object(base64["decode"])(data.ciphertext);
4708
4445
  if (cipherText.length < this.nacl.secretbox.overheadLength) {
4709
- logger.error("Expected encrypted event ciphertext length to be " + this.nacl.secretbox.overheadLength + ", got: " + cipherText.length);
4446
+ logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
4710
4447
  return;
4711
4448
  }
4712
- var nonce = Object(base64["decode"])(data.nonce);
4449
+ let nonce = Object(base64["decode"])(data.nonce);
4713
4450
  if (nonce.length < this.nacl.secretbox.nonceLength) {
4714
- logger.error("Expected encrypted event nonce length to be " + this.nacl.secretbox.nonceLength + ", got: " + nonce.length);
4451
+ logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
4715
4452
  return;
4716
4453
  }
4717
- var bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
4454
+ let bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
4718
4455
  if (bytes === null) {
4719
4456
  logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
4720
- this.authorize(this.pusher.connection.socket_id, function (error, authData) {
4457
+ this.authorize(this.pusher.connection.socket_id, (error, authData) => {
4721
4458
  if (error) {
4722
- logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
4459
+ logger.error(`Failed to make a request to the authEndpoint: ${authData}. Unable to fetch new key, so dropping encrypted event`);
4723
4460
  return;
4724
4461
  }
4725
- bytes = _this.nacl.secretbox.open(cipherText, nonce, _this.key);
4462
+ bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
4726
4463
  if (bytes === null) {
4727
- logger.error("Failed to decrypt event with new key. Dropping encrypted event");
4464
+ logger.error(`Failed to decrypt event with new key. Dropping encrypted event`);
4728
4465
  return;
4729
4466
  }
4730
- _this.emit(event, _this.getDataToEmit(bytes));
4467
+ this.emit(event, this.getDataToEmit(bytes));
4731
4468
  return;
4732
4469
  });
4733
4470
  return;
4734
4471
  }
4735
4472
  this.emit(event, this.getDataToEmit(bytes));
4736
- };
4737
- EncryptedChannel.prototype.getDataToEmit = function (bytes) {
4738
- var raw = Object(utf8["decode"])(bytes);
4473
+ }
4474
+ getDataToEmit(bytes) {
4475
+ let raw = Object(utf8["decode"])(bytes);
4739
4476
  try {
4740
4477
  return JSON.parse(raw);
4741
4478
  }
4742
4479
  catch (_a) {
4743
4480
  return raw;
4744
4481
  }
4745
- };
4746
- return EncryptedChannel;
4747
- }(private_channel));
4748
- /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
4482
+ }
4483
+ }
4749
4484
 
4750
4485
  // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
4751
- var connection_manager_extends = (undefined && undefined.__extends) || (function () {
4752
- var extendStatics = function (d, b) {
4753
- extendStatics = Object.setPrototypeOf ||
4754
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4755
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4756
- return extendStatics(d, b);
4757
- };
4758
- return function (d, b) {
4759
- extendStatics(d, b);
4760
- function __() { this.constructor = d; }
4761
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4762
- };
4763
- })();
4764
4486
 
4765
4487
 
4766
4488
 
4767
4489
 
4768
4490
 
4769
- var connection_manager_ConnectionManager = (function (_super) {
4770
- connection_manager_extends(ConnectionManager, _super);
4771
- function ConnectionManager(key, options) {
4772
- var _this = _super.call(this) || this;
4773
- _this.state = 'initialized';
4774
- _this.connection = null;
4775
- _this.key = key;
4776
- _this.options = options;
4777
- _this.timeline = _this.options.timeline;
4778
- _this.usingTLS = _this.options.useTLS;
4779
- _this.errorCallbacks = _this.buildErrorCallbacks();
4780
- _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
4781
- _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
4491
+ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
4492
+ constructor(key, options) {
4493
+ super();
4494
+ this.state = 'initialized';
4495
+ this.connection = null;
4496
+ this.key = key;
4497
+ this.options = options;
4498
+ this.timeline = this.options.timeline;
4499
+ this.usingTLS = this.options.useTLS;
4500
+ this.errorCallbacks = this.buildErrorCallbacks();
4501
+ this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks);
4502
+ this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
4782
4503
  var Network = worker_runtime.getNetwork();
4783
- Network.bind('online', function () {
4784
- _this.timeline.info({ netinfo: 'online' });
4785
- if (_this.state === 'connecting' || _this.state === 'unavailable') {
4786
- _this.retryIn(0);
4504
+ Network.bind('online', () => {
4505
+ this.timeline.info({ netinfo: 'online' });
4506
+ if (this.state === 'connecting' || this.state === 'unavailable') {
4507
+ this.retryIn(0);
4787
4508
  }
4788
4509
  });
4789
- Network.bind('offline', function () {
4790
- _this.timeline.info({ netinfo: 'offline' });
4791
- if (_this.connection) {
4792
- _this.sendActivityCheck();
4510
+ Network.bind('offline', () => {
4511
+ this.timeline.info({ netinfo: 'offline' });
4512
+ if (this.connection) {
4513
+ this.sendActivityCheck();
4793
4514
  }
4794
4515
  });
4795
- _this.updateStrategy();
4796
- return _this;
4516
+ this.updateStrategy();
4797
4517
  }
4798
- ConnectionManager.prototype.connect = function () {
4518
+ connect() {
4799
4519
  if (this.connection || this.runner) {
4800
4520
  return;
4801
4521
  }
@@ -4806,59 +4526,58 @@ var connection_manager_ConnectionManager = (function (_super) {
4806
4526
  this.updateState('connecting');
4807
4527
  this.startConnecting();
4808
4528
  this.setUnavailableTimer();
4809
- };
4810
- ConnectionManager.prototype.send = function (data) {
4529
+ }
4530
+ send(data) {
4811
4531
  if (this.connection) {
4812
4532
  return this.connection.send(data);
4813
4533
  }
4814
4534
  else {
4815
4535
  return false;
4816
4536
  }
4817
- };
4818
- ConnectionManager.prototype.send_event = function (name, data, channel) {
4537
+ }
4538
+ send_event(name, data, channel) {
4819
4539
  if (this.connection) {
4820
4540
  return this.connection.send_event(name, data, channel);
4821
4541
  }
4822
4542
  else {
4823
4543
  return false;
4824
4544
  }
4825
- };
4826
- ConnectionManager.prototype.disconnect = function () {
4545
+ }
4546
+ disconnect() {
4827
4547
  this.disconnectInternally();
4828
4548
  this.updateState('disconnected');
4829
- };
4830
- ConnectionManager.prototype.isUsingTLS = function () {
4549
+ }
4550
+ isUsingTLS() {
4831
4551
  return this.usingTLS;
4832
- };
4833
- ConnectionManager.prototype.startConnecting = function () {
4834
- var _this = this;
4835
- var callback = function (error, handshake) {
4552
+ }
4553
+ startConnecting() {
4554
+ var callback = (error, handshake) => {
4836
4555
  if (error) {
4837
- _this.runner = _this.strategy.connect(0, callback);
4556
+ this.runner = this.strategy.connect(0, callback);
4838
4557
  }
4839
4558
  else {
4840
4559
  if (handshake.action === 'error') {
4841
- _this.emit('error', {
4560
+ this.emit('error', {
4842
4561
  type: 'HandshakeError',
4843
4562
  error: handshake.error
4844
4563
  });
4845
- _this.timeline.error({ handshakeError: handshake.error });
4564
+ this.timeline.error({ handshakeError: handshake.error });
4846
4565
  }
4847
4566
  else {
4848
- _this.abortConnecting();
4849
- _this.handshakeCallbacks[handshake.action](handshake);
4567
+ this.abortConnecting();
4568
+ this.handshakeCallbacks[handshake.action](handshake);
4850
4569
  }
4851
4570
  }
4852
4571
  };
4853
4572
  this.runner = this.strategy.connect(0, callback);
4854
- };
4855
- ConnectionManager.prototype.abortConnecting = function () {
4573
+ }
4574
+ abortConnecting() {
4856
4575
  if (this.runner) {
4857
4576
  this.runner.abort();
4858
4577
  this.runner = null;
4859
4578
  }
4860
- };
4861
- ConnectionManager.prototype.disconnectInternally = function () {
4579
+ }
4580
+ disconnectInternally() {
4862
4581
  this.abortConnecting();
4863
4582
  this.clearRetryTimer();
4864
4583
  this.clearUnavailableTimer();
@@ -4866,136 +4585,129 @@ var connection_manager_ConnectionManager = (function (_super) {
4866
4585
  var connection = this.abandonConnection();
4867
4586
  connection.close();
4868
4587
  }
4869
- };
4870
- ConnectionManager.prototype.updateStrategy = function () {
4588
+ }
4589
+ updateStrategy() {
4871
4590
  this.strategy = this.options.getStrategy({
4872
4591
  key: this.key,
4873
4592
  timeline: this.timeline,
4874
4593
  useTLS: this.usingTLS
4875
4594
  });
4876
- };
4877
- ConnectionManager.prototype.retryIn = function (delay) {
4878
- var _this = this;
4595
+ }
4596
+ retryIn(delay) {
4879
4597
  this.timeline.info({ action: 'retry', delay: delay });
4880
4598
  if (delay > 0) {
4881
4599
  this.emit('connecting_in', Math.round(delay / 1000));
4882
4600
  }
4883
- this.retryTimer = new OneOffTimer(delay || 0, function () {
4884
- _this.disconnectInternally();
4885
- _this.connect();
4601
+ this.retryTimer = new timers_OneOffTimer(delay || 0, () => {
4602
+ this.disconnectInternally();
4603
+ this.connect();
4886
4604
  });
4887
- };
4888
- ConnectionManager.prototype.clearRetryTimer = function () {
4605
+ }
4606
+ clearRetryTimer() {
4889
4607
  if (this.retryTimer) {
4890
4608
  this.retryTimer.ensureAborted();
4891
4609
  this.retryTimer = null;
4892
4610
  }
4893
- };
4894
- ConnectionManager.prototype.setUnavailableTimer = function () {
4895
- var _this = this;
4896
- this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
4897
- _this.updateState('unavailable');
4611
+ }
4612
+ setUnavailableTimer() {
4613
+ this.unavailableTimer = new timers_OneOffTimer(this.options.unavailableTimeout, () => {
4614
+ this.updateState('unavailable');
4898
4615
  });
4899
- };
4900
- ConnectionManager.prototype.clearUnavailableTimer = function () {
4616
+ }
4617
+ clearUnavailableTimer() {
4901
4618
  if (this.unavailableTimer) {
4902
4619
  this.unavailableTimer.ensureAborted();
4903
4620
  }
4904
- };
4905
- ConnectionManager.prototype.sendActivityCheck = function () {
4906
- var _this = this;
4621
+ }
4622
+ sendActivityCheck() {
4907
4623
  this.stopActivityCheck();
4908
4624
  this.connection.ping();
4909
- this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
4910
- _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
4911
- _this.retryIn(0);
4625
+ this.activityTimer = new timers_OneOffTimer(this.options.pongTimeout, () => {
4626
+ this.timeline.error({ pong_timed_out: this.options.pongTimeout });
4627
+ this.retryIn(0);
4912
4628
  });
4913
- };
4914
- ConnectionManager.prototype.resetActivityCheck = function () {
4915
- var _this = this;
4629
+ }
4630
+ resetActivityCheck() {
4916
4631
  this.stopActivityCheck();
4917
4632
  if (this.connection && !this.connection.handlesActivityChecks()) {
4918
- this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
4919
- _this.sendActivityCheck();
4633
+ this.activityTimer = new timers_OneOffTimer(this.activityTimeout, () => {
4634
+ this.sendActivityCheck();
4920
4635
  });
4921
4636
  }
4922
- };
4923
- ConnectionManager.prototype.stopActivityCheck = function () {
4637
+ }
4638
+ stopActivityCheck() {
4924
4639
  if (this.activityTimer) {
4925
4640
  this.activityTimer.ensureAborted();
4926
4641
  }
4927
- };
4928
- ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
4929
- var _this = this;
4642
+ }
4643
+ buildConnectionCallbacks(errorCallbacks) {
4930
4644
  return extend({}, errorCallbacks, {
4931
- message: function (message) {
4932
- _this.resetActivityCheck();
4933
- _this.emit('message', message);
4645
+ message: message => {
4646
+ this.resetActivityCheck();
4647
+ this.emit('message', message);
4934
4648
  },
4935
- ping: function () {
4936
- _this.send_event('pusher:pong', {});
4649
+ ping: () => {
4650
+ this.send_event('pusher:pong', {});
4937
4651
  },
4938
- activity: function () {
4939
- _this.resetActivityCheck();
4652
+ activity: () => {
4653
+ this.resetActivityCheck();
4940
4654
  },
4941
- error: function (error) {
4942
- _this.emit('error', error);
4655
+ error: error => {
4656
+ this.emit('error', error);
4943
4657
  },
4944
- closed: function () {
4945
- _this.abandonConnection();
4946
- if (_this.shouldRetry()) {
4947
- _this.retryIn(1000);
4658
+ closed: () => {
4659
+ this.abandonConnection();
4660
+ if (this.shouldRetry()) {
4661
+ this.retryIn(1000);
4948
4662
  }
4949
4663
  }
4950
4664
  });
4951
- };
4952
- ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
4953
- var _this = this;
4665
+ }
4666
+ buildHandshakeCallbacks(errorCallbacks) {
4954
4667
  return extend({}, errorCallbacks, {
4955
- connected: function (handshake) {
4956
- _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
4957
- _this.clearUnavailableTimer();
4958
- _this.setConnection(handshake.connection);
4959
- _this.socket_id = _this.connection.id;
4960
- _this.updateState('connected', { socket_id: _this.socket_id });
4668
+ connected: (handshake) => {
4669
+ this.activityTimeout = Math.min(this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
4670
+ this.clearUnavailableTimer();
4671
+ this.setConnection(handshake.connection);
4672
+ this.socket_id = this.connection.id;
4673
+ this.updateState('connected', { socket_id: this.socket_id });
4961
4674
  }
4962
4675
  });
4963
- };
4964
- ConnectionManager.prototype.buildErrorCallbacks = function () {
4965
- var _this = this;
4966
- var withErrorEmitted = function (callback) {
4967
- return function (result) {
4676
+ }
4677
+ buildErrorCallbacks() {
4678
+ let withErrorEmitted = callback => {
4679
+ return (result) => {
4968
4680
  if (result.error) {
4969
- _this.emit('error', { type: 'WebSocketError', error: result.error });
4681
+ this.emit('error', { type: 'WebSocketError', error: result.error });
4970
4682
  }
4971
4683
  callback(result);
4972
4684
  };
4973
4685
  };
4974
4686
  return {
4975
- tls_only: withErrorEmitted(function () {
4976
- _this.usingTLS = true;
4977
- _this.updateStrategy();
4978
- _this.retryIn(0);
4687
+ tls_only: withErrorEmitted(() => {
4688
+ this.usingTLS = true;
4689
+ this.updateStrategy();
4690
+ this.retryIn(0);
4979
4691
  }),
4980
- refused: withErrorEmitted(function () {
4981
- _this.disconnect();
4692
+ refused: withErrorEmitted(() => {
4693
+ this.disconnect();
4982
4694
  }),
4983
- backoff: withErrorEmitted(function () {
4984
- _this.retryIn(1000);
4695
+ backoff: withErrorEmitted(() => {
4696
+ this.retryIn(1000);
4985
4697
  }),
4986
- retry: withErrorEmitted(function () {
4987
- _this.retryIn(0);
4698
+ retry: withErrorEmitted(() => {
4699
+ this.retryIn(0);
4988
4700
  })
4989
4701
  };
4990
- };
4991
- ConnectionManager.prototype.setConnection = function (connection) {
4702
+ }
4703
+ setConnection(connection) {
4992
4704
  this.connection = connection;
4993
4705
  for (var event in this.connectionCallbacks) {
4994
4706
  this.connection.bind(event, this.connectionCallbacks[event]);
4995
4707
  }
4996
4708
  this.resetActivityCheck();
4997
- };
4998
- ConnectionManager.prototype.abandonConnection = function () {
4709
+ }
4710
+ abandonConnection() {
4999
4711
  if (!this.connection) {
5000
4712
  return;
5001
4713
  }
@@ -5006,8 +4718,8 @@ var connection_manager_ConnectionManager = (function (_super) {
5006
4718
  var connection = this.connection;
5007
4719
  this.connection = null;
5008
4720
  return connection;
5009
- };
5010
- ConnectionManager.prototype.updateState = function (newState, data) {
4721
+ }
4722
+ updateState(newState, data) {
5011
4723
  var previousState = this.state;
5012
4724
  this.state = newState;
5013
4725
  if (previousState !== newState) {
@@ -5020,56 +4732,52 @@ var connection_manager_ConnectionManager = (function (_super) {
5020
4732
  this.emit('state_change', { previous: previousState, current: newState });
5021
4733
  this.emit(newState, data);
5022
4734
  }
5023
- };
5024
- ConnectionManager.prototype.shouldRetry = function () {
4735
+ }
4736
+ shouldRetry() {
5025
4737
  return this.state === 'connecting' || this.state === 'connected';
5026
- };
5027
- return ConnectionManager;
5028
- }(dispatcher));
5029
- /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
4738
+ }
4739
+ }
5030
4740
 
5031
4741
  // CONCATENATED MODULE: ./src/core/channels/channels.ts
5032
4742
 
5033
4743
 
5034
4744
 
5035
4745
 
5036
- var channels_Channels = (function () {
5037
- function Channels() {
4746
+ class channels_Channels {
4747
+ constructor() {
5038
4748
  this.channels = {};
5039
4749
  }
5040
- Channels.prototype.add = function (name, pusher) {
4750
+ add(name, pusher) {
5041
4751
  if (!this.channels[name]) {
5042
4752
  this.channels[name] = createChannel(name, pusher);
5043
4753
  }
5044
4754
  return this.channels[name];
5045
- };
5046
- Channels.prototype.all = function () {
4755
+ }
4756
+ all() {
5047
4757
  return values(this.channels);
5048
- };
5049
- Channels.prototype.find = function (name) {
4758
+ }
4759
+ find(name) {
5050
4760
  return this.channels[name];
5051
- };
5052
- Channels.prototype.remove = function (name) {
4761
+ }
4762
+ remove(name) {
5053
4763
  var channel = this.channels[name];
5054
4764
  delete this.channels[name];
5055
4765
  return channel;
5056
- };
5057
- Channels.prototype.disconnect = function () {
4766
+ }
4767
+ disconnect() {
5058
4768
  objectApply(this.channels, function (channel) {
5059
4769
  channel.disconnect();
5060
4770
  });
5061
- };
5062
- return Channels;
5063
- }());
5064
- /* harmony default export */ var channels = (channels_Channels);
4771
+ }
4772
+ }
5065
4773
  function createChannel(name, pusher) {
5066
4774
  if (name.indexOf('private-encrypted-') === 0) {
5067
4775
  if (pusher.config.nacl) {
5068
4776
  return factory.createEncryptedChannel(name, pusher, pusher.config.nacl);
5069
4777
  }
5070
- var errMsg = 'Tried to subscribe to a private-encrypted- channel but no nacl implementation available';
5071
- var suffix = url_store.buildLogSuffix('encryptedChannelSupport');
5072
- throw new UnsupportedFeature(errMsg + ". " + suffix);
4778
+ let errMsg = 'Tried to subscribe to a private-encrypted- channel but no nacl implementation available';
4779
+ let suffix = url_store.buildLogSuffix('encryptedChannelSupport');
4780
+ throw new UnsupportedFeature(`${errMsg}. ${suffix}`);
5073
4781
  }
5074
4782
  else if (name.indexOf('private-') === 0) {
5075
4783
  return factory.createPrivateChannel(name, pusher);
@@ -5096,97 +4804,94 @@ function createChannel(name, pusher) {
5096
4804
 
5097
4805
 
5098
4806
  var Factory = {
5099
- createChannels: function () {
5100
- return new channels();
4807
+ createChannels() {
4808
+ return new channels_Channels();
5101
4809
  },
5102
- createConnectionManager: function (key, options) {
5103
- return new connection_manager(key, options);
4810
+ createConnectionManager(key, options) {
4811
+ return new connection_manager_ConnectionManager(key, options);
5104
4812
  },
5105
- createChannel: function (name, pusher) {
5106
- return new channels_channel(name, pusher);
4813
+ createChannel(name, pusher) {
4814
+ return new channel_Channel(name, pusher);
5107
4815
  },
5108
- createPrivateChannel: function (name, pusher) {
5109
- return new private_channel(name, pusher);
4816
+ createPrivateChannel(name, pusher) {
4817
+ return new private_channel_PrivateChannel(name, pusher);
5110
4818
  },
5111
- createPresenceChannel: function (name, pusher) {
5112
- return new presence_channel(name, pusher);
4819
+ createPresenceChannel(name, pusher) {
4820
+ return new presence_channel_PresenceChannel(name, pusher);
5113
4821
  },
5114
- createEncryptedChannel: function (name, pusher, nacl) {
5115
- return new encrypted_channel(name, pusher, nacl);
4822
+ createEncryptedChannel(name, pusher, nacl) {
4823
+ return new encrypted_channel_EncryptedChannel(name, pusher, nacl);
5116
4824
  },
5117
- createTimelineSender: function (timeline, options) {
5118
- return new timeline_sender(timeline, options);
4825
+ createTimelineSender(timeline, options) {
4826
+ return new timeline_sender_TimelineSender(timeline, options);
5119
4827
  },
5120
- createHandshake: function (transport, callback) {
5121
- return new connection_handshake(transport, callback);
4828
+ createHandshake(transport, callback) {
4829
+ return new handshake_Handshake(transport, callback);
5122
4830
  },
5123
- createAssistantToTheTransportManager: function (manager, transport, options) {
5124
- return new assistant_to_the_transport_manager(manager, transport, options);
4831
+ createAssistantToTheTransportManager(manager, transport, options) {
4832
+ return new assistant_to_the_transport_manager_AssistantToTheTransportManager(manager, transport, options);
5125
4833
  }
5126
4834
  };
5127
4835
  /* harmony default export */ var factory = (Factory);
5128
4836
 
5129
4837
  // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
5130
4838
 
5131
- var transport_manager_TransportManager = (function () {
5132
- function TransportManager(options) {
4839
+ class transport_manager_TransportManager {
4840
+ constructor(options) {
5133
4841
  this.options = options || {};
5134
4842
  this.livesLeft = this.options.lives || Infinity;
5135
4843
  }
5136
- TransportManager.prototype.getAssistant = function (transport) {
4844
+ getAssistant(transport) {
5137
4845
  return factory.createAssistantToTheTransportManager(this, transport, {
5138
4846
  minPingDelay: this.options.minPingDelay,
5139
4847
  maxPingDelay: this.options.maxPingDelay
5140
4848
  });
5141
- };
5142
- TransportManager.prototype.isAlive = function () {
4849
+ }
4850
+ isAlive() {
5143
4851
  return this.livesLeft > 0;
5144
- };
5145
- TransportManager.prototype.reportDeath = function () {
4852
+ }
4853
+ reportDeath() {
5146
4854
  this.livesLeft -= 1;
5147
- };
5148
- return TransportManager;
5149
- }());
5150
- /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
4855
+ }
4856
+ }
5151
4857
 
5152
4858
  // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
5153
4859
 
5154
4860
 
5155
4861
 
5156
- var sequential_strategy_SequentialStrategy = (function () {
5157
- function SequentialStrategy(strategies, options) {
4862
+ class sequential_strategy_SequentialStrategy {
4863
+ constructor(strategies, options) {
5158
4864
  this.strategies = strategies;
5159
4865
  this.loop = Boolean(options.loop);
5160
4866
  this.failFast = Boolean(options.failFast);
5161
4867
  this.timeout = options.timeout;
5162
4868
  this.timeoutLimit = options.timeoutLimit;
5163
4869
  }
5164
- SequentialStrategy.prototype.isSupported = function () {
4870
+ isSupported() {
5165
4871
  return any(this.strategies, util.method('isSupported'));
5166
- };
5167
- SequentialStrategy.prototype.connect = function (minPriority, callback) {
5168
- var _this = this;
4872
+ }
4873
+ connect(minPriority, callback) {
5169
4874
  var strategies = this.strategies;
5170
4875
  var current = 0;
5171
4876
  var timeout = this.timeout;
5172
4877
  var runner = null;
5173
- var tryNextStrategy = function (error, handshake) {
4878
+ var tryNextStrategy = (error, handshake) => {
5174
4879
  if (handshake) {
5175
4880
  callback(null, handshake);
5176
4881
  }
5177
4882
  else {
5178
4883
  current = current + 1;
5179
- if (_this.loop) {
4884
+ if (this.loop) {
5180
4885
  current = current % strategies.length;
5181
4886
  }
5182
4887
  if (current < strategies.length) {
5183
4888
  if (timeout) {
5184
4889
  timeout = timeout * 2;
5185
- if (_this.timeoutLimit) {
5186
- timeout = Math.min(timeout, _this.timeoutLimit);
4890
+ if (this.timeoutLimit) {
4891
+ timeout = Math.min(timeout, this.timeoutLimit);
5187
4892
  }
5188
4893
  }
5189
- runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
4894
+ runner = this.tryStrategy(strategies[current], minPriority, { timeout, failFast: this.failFast }, tryNextStrategy);
5190
4895
  }
5191
4896
  else {
5192
4897
  callback(true);
@@ -5205,12 +4910,12 @@ var sequential_strategy_SequentialStrategy = (function () {
5205
4910
  }
5206
4911
  }
5207
4912
  };
5208
- };
5209
- SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
4913
+ }
4914
+ tryStrategy(strategy, minPriority, options, callback) {
5210
4915
  var timer = null;
5211
4916
  var runner = null;
5212
4917
  if (options.timeout > 0) {
5213
- timer = new OneOffTimer(options.timeout, function () {
4918
+ timer = new timers_OneOffTimer(options.timeout, function () {
5214
4919
  runner.abort();
5215
4920
  callback(true);
5216
4921
  });
@@ -5235,22 +4940,20 @@ var sequential_strategy_SequentialStrategy = (function () {
5235
4940
  runner.forceMinPriority(p);
5236
4941
  }
5237
4942
  };
5238
- };
5239
- return SequentialStrategy;
5240
- }());
5241
- /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
4943
+ }
4944
+ }
5242
4945
 
5243
4946
  // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
5244
4947
 
5245
4948
 
5246
- var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
5247
- function BestConnectedEverStrategy(strategies) {
4949
+ class best_connected_ever_strategy_BestConnectedEverStrategy {
4950
+ constructor(strategies) {
5248
4951
  this.strategies = strategies;
5249
4952
  }
5250
- BestConnectedEverStrategy.prototype.isSupported = function () {
4953
+ isSupported() {
5251
4954
  return any(this.strategies, util.method('isSupported'));
5252
- };
5253
- BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
4955
+ }
4956
+ connect(minPriority, callback) {
5254
4957
  return connect(this.strategies, minPriority, function (i, runners) {
5255
4958
  return function (error, handshake) {
5256
4959
  runners[i].error = error;
@@ -5266,10 +4969,8 @@ var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
5266
4969
  callback(null, handshake);
5267
4970
  };
5268
4971
  });
5269
- };
5270
- return BestConnectedEverStrategy;
5271
- }());
5272
- /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
4972
+ }
4973
+ }
5273
4974
  function connect(strategies, minPriority, callbackBuilder) {
5274
4975
  var runners = map(strategies, function (strategy, i, _, rs) {
5275
4976
  return strategy.connect(minPriority, callbackBuilder(i, rs));
@@ -5302,18 +5003,18 @@ function abortRunner(runner) {
5302
5003
 
5303
5004
 
5304
5005
 
5305
- var cached_strategy_CachedStrategy = (function () {
5306
- function CachedStrategy(strategy, transports, options) {
5006
+ class cached_strategy_CachedStrategy {
5007
+ constructor(strategy, transports, options) {
5307
5008
  this.strategy = strategy;
5308
5009
  this.transports = transports;
5309
5010
  this.ttl = options.ttl || 1800 * 1000;
5310
5011
  this.usingTLS = options.useTLS;
5311
5012
  this.timeline = options.timeline;
5312
5013
  }
5313
- CachedStrategy.prototype.isSupported = function () {
5014
+ isSupported() {
5314
5015
  return this.strategy.isSupported();
5315
- };
5316
- CachedStrategy.prototype.connect = function (minPriority, callback) {
5016
+ }
5017
+ connect(minPriority, callback) {
5317
5018
  var usingTLS = this.usingTLS;
5318
5019
  var info = fetchTransportCache(usingTLS);
5319
5020
  var strategies = [this.strategy];
@@ -5325,7 +5026,7 @@ var cached_strategy_CachedStrategy = (function () {
5325
5026
  transport: info.transport,
5326
5027
  latency: info.latency
5327
5028
  });
5328
- strategies.push(new sequential_strategy([transport], {
5029
+ strategies.push(new sequential_strategy_SequentialStrategy([transport], {
5329
5030
  timeout: info.latency * 2 + 1000,
5330
5031
  failFast: true
5331
5032
  }));
@@ -5361,10 +5062,8 @@ var cached_strategy_CachedStrategy = (function () {
5361
5062
  }
5362
5063
  }
5363
5064
  };
5364
- };
5365
- return CachedStrategy;
5366
- }());
5367
- /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
5065
+ }
5066
+ }
5368
5067
  function getTransportCacheKey(usingTLS) {
5369
5068
  return 'pusherTransport' + (usingTLS ? 'TLS' : 'NonTLS');
5370
5069
  }
@@ -5410,19 +5109,18 @@ function flushTransportCache(usingTLS) {
5410
5109
 
5411
5110
  // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
5412
5111
 
5413
- var delayed_strategy_DelayedStrategy = (function () {
5414
- function DelayedStrategy(strategy, _a) {
5415
- var number = _a.delay;
5112
+ class delayed_strategy_DelayedStrategy {
5113
+ constructor(strategy, { delay: number }) {
5416
5114
  this.strategy = strategy;
5417
5115
  this.options = { delay: number };
5418
5116
  }
5419
- DelayedStrategy.prototype.isSupported = function () {
5117
+ isSupported() {
5420
5118
  return this.strategy.isSupported();
5421
- };
5422
- DelayedStrategy.prototype.connect = function (minPriority, callback) {
5119
+ }
5120
+ connect(minPriority, callback) {
5423
5121
  var strategy = this.strategy;
5424
5122
  var runner;
5425
- var timer = new OneOffTimer(this.options.delay, function () {
5123
+ var timer = new timers_OneOffTimer(this.options.delay, function () {
5426
5124
  runner = strategy.connect(minPriority, callback);
5427
5125
  });
5428
5126
  return {
@@ -5439,39 +5137,35 @@ var delayed_strategy_DelayedStrategy = (function () {
5439
5137
  }
5440
5138
  }
5441
5139
  };
5442
- };
5443
- return DelayedStrategy;
5444
- }());
5445
- /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
5140
+ }
5141
+ }
5446
5142
 
5447
5143
  // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
5448
- var IfStrategy = (function () {
5449
- function IfStrategy(test, trueBranch, falseBranch) {
5144
+ class IfStrategy {
5145
+ constructor(test, trueBranch, falseBranch) {
5450
5146
  this.test = test;
5451
5147
  this.trueBranch = trueBranch;
5452
5148
  this.falseBranch = falseBranch;
5453
5149
  }
5454
- IfStrategy.prototype.isSupported = function () {
5150
+ isSupported() {
5455
5151
  var branch = this.test() ? this.trueBranch : this.falseBranch;
5456
5152
  return branch.isSupported();
5457
- };
5458
- IfStrategy.prototype.connect = function (minPriority, callback) {
5153
+ }
5154
+ connect(minPriority, callback) {
5459
5155
  var branch = this.test() ? this.trueBranch : this.falseBranch;
5460
5156
  return branch.connect(minPriority, callback);
5461
- };
5462
- return IfStrategy;
5463
- }());
5464
- /* harmony default export */ var if_strategy = (IfStrategy);
5157
+ }
5158
+ }
5465
5159
 
5466
5160
  // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
5467
- var FirstConnectedStrategy = (function () {
5468
- function FirstConnectedStrategy(strategy) {
5161
+ class FirstConnectedStrategy {
5162
+ constructor(strategy) {
5469
5163
  this.strategy = strategy;
5470
5164
  }
5471
- FirstConnectedStrategy.prototype.isSupported = function () {
5165
+ isSupported() {
5472
5166
  return this.strategy.isSupported();
5473
- };
5474
- FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
5167
+ }
5168
+ connect(minPriority, callback) {
5475
5169
  var runner = this.strategy.connect(minPriority, function (error, handshake) {
5476
5170
  if (handshake) {
5477
5171
  runner.abort();
@@ -5479,10 +5173,8 @@ var FirstConnectedStrategy = (function () {
5479
5173
  callback(error, handshake);
5480
5174
  });
5481
5175
  return runner;
5482
- };
5483
- return FirstConnectedStrategy;
5484
- }());
5485
- /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
5176
+ }
5177
+ }
5486
5178
 
5487
5179
  // CONCATENATED MODULE: ./src/runtimes/isomorphic/default_strategy.ts
5488
5180
 
@@ -5523,12 +5215,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
5523
5215
  timeout: 15000,
5524
5216
  timeoutLimit: 60000
5525
5217
  };
5526
- var ws_manager = new transport_manager({
5527
- lives: 2,
5218
+ var ws_manager = new transport_manager_TransportManager({
5528
5219
  minPingDelay: 10000,
5529
5220
  maxPingDelay: config.activityTimeout
5530
5221
  });
5531
- var streaming_manager = new transport_manager({
5222
+ var streaming_manager = new transport_manager_TransportManager({
5532
5223
  lives: 2,
5533
5224
  minPingDelay: 10000,
5534
5225
  maxPingDelay: config.activityTimeout
@@ -5537,31 +5228,31 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
5537
5228
  var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager);
5538
5229
  var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, http_options, streaming_manager);
5539
5230
  var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, http_options);
5540
- var ws_loop = new sequential_strategy([ws_transport], timeouts);
5541
- var wss_loop = new sequential_strategy([wss_transport], timeouts);
5542
- var streaming_loop = new sequential_strategy([xhr_streaming_transport], timeouts);
5543
- var polling_loop = new sequential_strategy([xhr_polling_transport], timeouts);
5544
- var http_loop = new sequential_strategy([
5545
- new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([
5231
+ var ws_loop = new sequential_strategy_SequentialStrategy([ws_transport], timeouts);
5232
+ var wss_loop = new sequential_strategy_SequentialStrategy([wss_transport], timeouts);
5233
+ var streaming_loop = new sequential_strategy_SequentialStrategy([xhr_streaming_transport], timeouts);
5234
+ var polling_loop = new sequential_strategy_SequentialStrategy([xhr_polling_transport], timeouts);
5235
+ var http_loop = new sequential_strategy_SequentialStrategy([
5236
+ new IfStrategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy_BestConnectedEverStrategy([
5546
5237
  streaming_loop,
5547
- new delayed_strategy(polling_loop, { delay: 4000 })
5238
+ new delayed_strategy_DelayedStrategy(polling_loop, { delay: 4000 })
5548
5239
  ]), polling_loop)
5549
5240
  ], timeouts);
5550
5241
  var wsStrategy;
5551
5242
  if (baseOptions.useTLS) {
5552
- wsStrategy = new best_connected_ever_strategy([
5243
+ wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
5553
5244
  ws_loop,
5554
- new delayed_strategy(http_loop, { delay: 2000 })
5245
+ new delayed_strategy_DelayedStrategy(http_loop, { delay: 2000 })
5555
5246
  ]);
5556
5247
  }
5557
5248
  else {
5558
- wsStrategy = new best_connected_ever_strategy([
5249
+ wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
5559
5250
  ws_loop,
5560
- new delayed_strategy(wss_loop, { delay: 2000 }),
5561
- new delayed_strategy(http_loop, { delay: 5000 })
5251
+ new delayed_strategy_DelayedStrategy(wss_loop, { delay: 2000 }),
5252
+ new delayed_strategy_DelayedStrategy(http_loop, { delay: 5000 })
5562
5253
  ]);
5563
5254
  }
5564
- return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_loop)), definedTransports, {
5255
+ return new cached_strategy_CachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_loop)), definedTransports, {
5565
5256
  ttl: 1800000,
5566
5257
  timeline: baseOptions.timeline,
5567
5258
  useTLS: baseOptions.useTLS
@@ -5584,37 +5275,21 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
5584
5275
  });
5585
5276
 
5586
5277
  // CONCATENATED MODULE: ./src/core/http/http_request.ts
5587
- var http_request_extends = (undefined && undefined.__extends) || (function () {
5588
- var extendStatics = function (d, b) {
5589
- extendStatics = Object.setPrototypeOf ||
5590
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5591
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5592
- return extendStatics(d, b);
5593
- };
5594
- return function (d, b) {
5595
- extendStatics(d, b);
5596
- function __() { this.constructor = d; }
5597
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5598
- };
5599
- })();
5600
5278
 
5601
5279
 
5602
- var MAX_BUFFER_LENGTH = 256 * 1024;
5603
- var http_request_HTTPRequest = (function (_super) {
5604
- http_request_extends(HTTPRequest, _super);
5605
- function HTTPRequest(hooks, method, url) {
5606
- var _this = _super.call(this) || this;
5607
- _this.hooks = hooks;
5608
- _this.method = method;
5609
- _this.url = url;
5610
- return _this;
5280
+ const MAX_BUFFER_LENGTH = 256 * 1024;
5281
+ class http_request_HTTPRequest extends dispatcher_Dispatcher {
5282
+ constructor(hooks, method, url) {
5283
+ super();
5284
+ this.hooks = hooks;
5285
+ this.method = method;
5286
+ this.url = url;
5611
5287
  }
5612
- HTTPRequest.prototype.start = function (payload) {
5613
- var _this = this;
5288
+ start(payload) {
5614
5289
  this.position = 0;
5615
5290
  this.xhr = this.hooks.getRequest(this);
5616
- this.unloader = function () {
5617
- _this.close();
5291
+ this.unloader = () => {
5292
+ this.close();
5618
5293
  };
5619
5294
  worker_runtime.addUnloadListener(this.unloader);
5620
5295
  this.xhr.open(this.method, this.url, true);
@@ -5622,8 +5297,8 @@ var http_request_HTTPRequest = (function (_super) {
5622
5297
  this.xhr.setRequestHeader('Content-Type', 'application/json');
5623
5298
  }
5624
5299
  this.xhr.send(payload);
5625
- };
5626
- HTTPRequest.prototype.close = function () {
5300
+ }
5301
+ close() {
5627
5302
  if (this.unloader) {
5628
5303
  worker_runtime.removeUnloadListener(this.unloader);
5629
5304
  this.unloader = null;
@@ -5632,8 +5307,8 @@ var http_request_HTTPRequest = (function (_super) {
5632
5307
  this.hooks.abortRequest(this.xhr);
5633
5308
  this.xhr = null;
5634
5309
  }
5635
- };
5636
- HTTPRequest.prototype.onChunk = function (status, data) {
5310
+ }
5311
+ onChunk(status, data) {
5637
5312
  while (true) {
5638
5313
  var chunk = this.advanceBuffer(data);
5639
5314
  if (chunk) {
@@ -5646,8 +5321,8 @@ var http_request_HTTPRequest = (function (_super) {
5646
5321
  if (this.isBufferTooLong(data)) {
5647
5322
  this.emit('buffer_too_long');
5648
5323
  }
5649
- };
5650
- HTTPRequest.prototype.advanceBuffer = function (buffer) {
5324
+ }
5325
+ advanceBuffer(buffer) {
5651
5326
  var unreadData = buffer.slice(this.position);
5652
5327
  var endOfLinePosition = unreadData.indexOf('\n');
5653
5328
  if (endOfLinePosition !== -1) {
@@ -5657,13 +5332,11 @@ var http_request_HTTPRequest = (function (_super) {
5657
5332
  else {
5658
5333
  return null;
5659
5334
  }
5660
- };
5661
- HTTPRequest.prototype.isBufferTooLong = function (buffer) {
5335
+ }
5336
+ isBufferTooLong(buffer) {
5662
5337
  return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
5663
- };
5664
- return HTTPRequest;
5665
- }(dispatcher));
5666
- /* harmony default export */ var http_request = (http_request_HTTPRequest);
5338
+ }
5339
+ }
5667
5340
 
5668
5341
  // CONCATENATED MODULE: ./src/core/http/state.ts
5669
5342
  var State;
@@ -5679,24 +5352,24 @@ var State;
5679
5352
 
5680
5353
 
5681
5354
  var autoIncrement = 1;
5682
- var http_socket_HTTPSocket = (function () {
5683
- function HTTPSocket(hooks, url) {
5355
+ class http_socket_HTTPSocket {
5356
+ constructor(hooks, url) {
5684
5357
  this.hooks = hooks;
5685
5358
  this.session = randomNumber(1000) + '/' + randomString(8);
5686
5359
  this.location = getLocation(url);
5687
5360
  this.readyState = state.CONNECTING;
5688
5361
  this.openStream();
5689
5362
  }
5690
- HTTPSocket.prototype.send = function (payload) {
5363
+ send(payload) {
5691
5364
  return this.sendRaw(JSON.stringify([payload]));
5692
- };
5693
- HTTPSocket.prototype.ping = function () {
5365
+ }
5366
+ ping() {
5694
5367
  this.hooks.sendHeartbeat(this);
5695
- };
5696
- HTTPSocket.prototype.close = function (code, reason) {
5368
+ }
5369
+ close(code, reason) {
5697
5370
  this.onClose(code, reason, true);
5698
- };
5699
- HTTPSocket.prototype.sendRaw = function (payload) {
5371
+ }
5372
+ sendRaw(payload) {
5700
5373
  if (this.readyState === state.OPEN) {
5701
5374
  try {
5702
5375
  worker_runtime.createSocketRequest('POST', getUniqueURL(getSendURL(this.location, this.session))).start(payload);
@@ -5709,12 +5382,12 @@ var http_socket_HTTPSocket = (function () {
5709
5382
  else {
5710
5383
  return false;
5711
5384
  }
5712
- };
5713
- HTTPSocket.prototype.reconnect = function () {
5385
+ }
5386
+ reconnect() {
5714
5387
  this.closeStream();
5715
5388
  this.openStream();
5716
- };
5717
- HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
5389
+ }
5390
+ onClose(code, reason, wasClean) {
5718
5391
  this.closeStream();
5719
5392
  this.readyState = state.CLOSED;
5720
5393
  if (this.onclose) {
@@ -5724,8 +5397,8 @@ var http_socket_HTTPSocket = (function () {
5724
5397
  wasClean: wasClean
5725
5398
  });
5726
5399
  }
5727
- };
5728
- HTTPSocket.prototype.onChunk = function (chunk) {
5400
+ }
5401
+ onChunk(chunk) {
5729
5402
  if (chunk.status !== 200) {
5730
5403
  return;
5731
5404
  }
@@ -5757,8 +5430,8 @@ var http_socket_HTTPSocket = (function () {
5757
5430
  this.onClose(payload[0], payload[1], true);
5758
5431
  break;
5759
5432
  }
5760
- };
5761
- HTTPSocket.prototype.onOpen = function (options) {
5433
+ }
5434
+ onOpen(options) {
5762
5435
  if (this.readyState === state.CONNECTING) {
5763
5436
  if (options && options.hostname) {
5764
5437
  this.location.base = replaceHost(this.location.base, options.hostname);
@@ -5771,53 +5444,51 @@ var http_socket_HTTPSocket = (function () {
5771
5444
  else {
5772
5445
  this.onClose(1006, 'Server lost session', true);
5773
5446
  }
5774
- };
5775
- HTTPSocket.prototype.onEvent = function (event) {
5447
+ }
5448
+ onEvent(event) {
5776
5449
  if (this.readyState === state.OPEN && this.onmessage) {
5777
5450
  this.onmessage({ data: event });
5778
5451
  }
5779
- };
5780
- HTTPSocket.prototype.onActivity = function () {
5452
+ }
5453
+ onActivity() {
5781
5454
  if (this.onactivity) {
5782
5455
  this.onactivity();
5783
5456
  }
5784
- };
5785
- HTTPSocket.prototype.onError = function (error) {
5457
+ }
5458
+ onError(error) {
5786
5459
  if (this.onerror) {
5787
5460
  this.onerror(error);
5788
5461
  }
5789
- };
5790
- HTTPSocket.prototype.openStream = function () {
5791
- var _this = this;
5462
+ }
5463
+ openStream() {
5792
5464
  this.stream = worker_runtime.createSocketRequest('POST', getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
5793
- this.stream.bind('chunk', function (chunk) {
5794
- _this.onChunk(chunk);
5465
+ this.stream.bind('chunk', chunk => {
5466
+ this.onChunk(chunk);
5795
5467
  });
5796
- this.stream.bind('finished', function (status) {
5797
- _this.hooks.onFinished(_this, status);
5468
+ this.stream.bind('finished', status => {
5469
+ this.hooks.onFinished(this, status);
5798
5470
  });
5799
- this.stream.bind('buffer_too_long', function () {
5800
- _this.reconnect();
5471
+ this.stream.bind('buffer_too_long', () => {
5472
+ this.reconnect();
5801
5473
  });
5802
5474
  try {
5803
5475
  this.stream.start();
5804
5476
  }
5805
5477
  catch (error) {
5806
- util.defer(function () {
5807
- _this.onError(error);
5808
- _this.onClose(1006, 'Could not start streaming', false);
5478
+ util.defer(() => {
5479
+ this.onError(error);
5480
+ this.onClose(1006, 'Could not start streaming', false);
5809
5481
  });
5810
5482
  }
5811
- };
5812
- HTTPSocket.prototype.closeStream = function () {
5483
+ }
5484
+ closeStream() {
5813
5485
  if (this.stream) {
5814
5486
  this.stream.unbind_all();
5815
5487
  this.stream.close();
5816
5488
  this.stream = null;
5817
5489
  }
5818
- };
5819
- return HTTPSocket;
5820
- }());
5490
+ }
5491
+ }
5821
5492
  function getLocation(url) {
5822
5493
  var parts = /([^\?]*)\/*(\??.*)/.exec(url);
5823
5494
  return {
@@ -5924,20 +5595,20 @@ var http_xhr_request_hooks = {
5924
5595
 
5925
5596
 
5926
5597
  var HTTP = {
5927
- createStreamingSocket: function (url) {
5598
+ createStreamingSocket(url) {
5928
5599
  return this.createSocket(http_streaming_socket, url);
5929
5600
  },
5930
- createPollingSocket: function (url) {
5601
+ createPollingSocket(url) {
5931
5602
  return this.createSocket(http_polling_socket, url);
5932
5603
  },
5933
- createSocket: function (hooks, url) {
5604
+ createSocket(hooks, url) {
5934
5605
  return new http_socket(hooks, url);
5935
5606
  },
5936
- createXHR: function (method, url) {
5607
+ createXHR(method, url) {
5937
5608
  return this.createRequest(http_xhr_request, method, url);
5938
5609
  },
5939
- createRequest: function (hooks, method, url) {
5940
- return new http_request(hooks, method, url);
5610
+ createRequest(hooks, method, url) {
5611
+ return new http_request_HTTPRequest(hooks, method, url);
5941
5612
  }
5942
5613
  };
5943
5614
  /* harmony default export */ var http_http = (HTTP);
@@ -5953,24 +5624,24 @@ var Isomorphic = {
5953
5624
  Transports: transports,
5954
5625
  transportConnectionInitializer: transport_connection_initializer,
5955
5626
  HTTPFactory: http_http,
5956
- setup: function (PusherClass) {
5627
+ setup(PusherClass) {
5957
5628
  PusherClass.ready();
5958
5629
  },
5959
- getLocalStorage: function () {
5630
+ getLocalStorage() {
5960
5631
  return undefined;
5961
5632
  },
5962
- getClientFeatures: function () {
5633
+ getClientFeatures() {
5963
5634
  return keys(filterObject({ ws: transports.ws }, function (t) {
5964
5635
  return t.isSupported({});
5965
5636
  }));
5966
5637
  },
5967
- getProtocol: function () {
5638
+ getProtocol() {
5968
5639
  return 'http:';
5969
5640
  },
5970
- isXHRSupported: function () {
5641
+ isXHRSupported() {
5971
5642
  return true;
5972
5643
  },
5973
- createSocketRequest: function (method, url) {
5644
+ createSocketRequest(method, url) {
5974
5645
  if (this.isXHRSupported()) {
5975
5646
  return this.HTTPFactory.createXHR(method, url);
5976
5647
  }
@@ -5978,46 +5649,27 @@ var Isomorphic = {
5978
5649
  throw 'Cross-origin HTTP requests are not supported';
5979
5650
  }
5980
5651
  },
5981
- createXHR: function () {
5652
+ createXHR() {
5982
5653
  var Constructor = this.getXHRAPI();
5983
5654
  return new Constructor();
5984
5655
  },
5985
- createWebSocket: function (url) {
5656
+ createWebSocket(url) {
5986
5657
  var Constructor = this.getWebSocketAPI();
5987
5658
  return new Constructor(url);
5988
5659
  },
5989
- addUnloadListener: function (listener) { },
5990
- removeUnloadListener: function (listener) { }
5660
+ addUnloadListener(listener) { },
5661
+ removeUnloadListener(listener) { }
5991
5662
  };
5992
5663
  /* harmony default export */ var runtime = (Isomorphic);
5993
5664
 
5994
5665
  // CONCATENATED MODULE: ./src/runtimes/worker/net_info.ts
5995
- var net_info_extends = (undefined && undefined.__extends) || (function () {
5996
- var extendStatics = function (d, b) {
5997
- extendStatics = Object.setPrototypeOf ||
5998
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5999
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6000
- return extendStatics(d, b);
6001
- };
6002
- return function (d, b) {
6003
- extendStatics(d, b);
6004
- function __() { this.constructor = d; }
6005
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6006
- };
6007
- })();
6008
5666
 
6009
- var NetInfo = (function (_super) {
6010
- net_info_extends(NetInfo, _super);
6011
- function NetInfo() {
6012
- return _super !== null && _super.apply(this, arguments) || this;
6013
- }
6014
- NetInfo.prototype.isOnline = function () {
5667
+ class net_info_NetInfo extends dispatcher_Dispatcher {
5668
+ isOnline() {
6015
5669
  return true;
6016
- };
6017
- return NetInfo;
6018
- }(dispatcher));
6019
-
6020
- var net_info_Network = new NetInfo();
5670
+ }
5671
+ }
5672
+ var net_info_Network = new net_info_NetInfo();
6021
5673
 
6022
5674
  // CONCATENATED MODULE: ./src/runtimes/worker/auth/fetch_auth.ts
6023
5675
 
@@ -6028,36 +5680,37 @@ var fetchAuth = function (context, query, authOptions, authRequestType, callback
6028
5680
  headers.set(headerName, authOptions.headers[headerName]);
6029
5681
  }
6030
5682
  if (authOptions.headersProvider != null) {
6031
- var dynamicHeaders = authOptions.headersProvider();
5683
+ const dynamicHeaders = authOptions.headersProvider();
6032
5684
  for (var headerName in dynamicHeaders) {
6033
5685
  headers.set(headerName, dynamicHeaders[headerName]);
6034
5686
  }
6035
5687
  }
6036
5688
  var body = query;
6037
5689
  var request = new Request(authOptions.endpoint, {
6038
- headers: headers,
6039
- body: body,
5690
+ headers,
5691
+ body,
6040
5692
  credentials: 'same-origin',
6041
5693
  method: 'POST'
6042
5694
  });
6043
5695
  return fetch(request)
6044
- .then(function (response) {
6045
- var status = response.status;
5696
+ .then(response => {
5697
+ let { status } = response;
6046
5698
  if (status === 200) {
6047
5699
  return response.text();
6048
5700
  }
6049
- throw new HTTPAuthError(status, "Could not get " + authRequestType.toString() + " info from your auth endpoint, status: " + status);
5701
+ throw new HTTPAuthError(status, `Could not get ${authRequestType.toString()} info from your auth endpoint, status: ${status}`);
6050
5702
  })
6051
- .then(function (data) {
6052
- var parsedData;
5703
+ .then(data => {
5704
+ let parsedData;
6053
5705
  try {
6054
5706
  parsedData = JSON.parse(data);
6055
5707
  }
6056
5708
  catch (e) {
6057
- throw new HTTPAuthError(200, "JSON returned from " + authRequestType.toString() + " endpoint was invalid, yet status code was 200. Data was: " + data);
5709
+ throw new HTTPAuthError(200, `JSON returned from ${authRequestType.toString()} endpoint was invalid, yet status code was 200. Data was: ${data}`);
6058
5710
  }
6059
5711
  callback(null, parsedData);
6060
- })["catch"](function (err) {
5712
+ })
5713
+ .catch(err => {
6061
5714
  callback(err, null);
6062
5715
  });
6063
5716
  };
@@ -6073,25 +5726,25 @@ var getAgent = function (sender, useTLS) {
6073
5726
  var query = buildQueryString(data);
6074
5727
  url += '/' + 2 + '?' + query;
6075
5728
  fetch(url)
6076
- .then(function (response) {
5729
+ .then(response => {
6077
5730
  if (response.status !== 200) {
6078
- throw "received " + response.status + " from stats.pusher.com";
5731
+ throw `received ${response.status} from stats.pusher.com`;
6079
5732
  }
6080
5733
  return response.json();
6081
5734
  })
6082
- .then(function (_a) {
6083
- var host = _a.host;
5735
+ .then(({ host }) => {
6084
5736
  if (host) {
6085
5737
  sender.host = host;
6086
5738
  }
6087
- })["catch"](function (err) {
5739
+ })
5740
+ .catch(err => {
6088
5741
  logger.debug('TimelineSender Error: ', err);
6089
5742
  });
6090
5743
  };
6091
5744
  };
6092
5745
  var fetchTimeline = {
6093
5746
  name: 'xhr',
6094
- getAgent: getAgent
5747
+ getAgent
6095
5748
  };
6096
5749
  /* harmony default export */ var fetch_timeline = (fetchTimeline);
6097
5750
 
@@ -6100,38 +5753,38 @@ var fetchTimeline = {
6100
5753
 
6101
5754
 
6102
5755
 
6103
- var runtime_getDefaultStrategy = runtime.getDefaultStrategy, runtime_Transports = runtime.Transports, setup = runtime.setup, getProtocol = runtime.getProtocol, isXHRSupported = runtime.isXHRSupported, getLocalStorage = runtime.getLocalStorage, createXHR = runtime.createXHR, createWebSocket = runtime.createWebSocket, addUnloadListener = runtime.addUnloadListener, removeUnloadListener = runtime.removeUnloadListener, transportConnectionInitializer = runtime.transportConnectionInitializer, createSocketRequest = runtime.createSocketRequest, HTTPFactory = runtime.HTTPFactory;
6104
- var Worker = {
5756
+ const { getDefaultStrategy: runtime_getDefaultStrategy, Transports: runtime_Transports, setup, getProtocol, isXHRSupported, getLocalStorage, createXHR, createWebSocket, addUnloadListener, removeUnloadListener, transportConnectionInitializer, createSocketRequest, HTTPFactory } = runtime;
5757
+ const Worker = {
6105
5758
  getDefaultStrategy: runtime_getDefaultStrategy,
6106
5759
  Transports: runtime_Transports,
6107
- setup: setup,
6108
- getProtocol: getProtocol,
6109
- isXHRSupported: isXHRSupported,
6110
- getLocalStorage: getLocalStorage,
6111
- createXHR: createXHR,
6112
- createWebSocket: createWebSocket,
6113
- addUnloadListener: addUnloadListener,
6114
- removeUnloadListener: removeUnloadListener,
6115
- transportConnectionInitializer: transportConnectionInitializer,
6116
- createSocketRequest: createSocketRequest,
6117
- HTTPFactory: HTTPFactory,
5760
+ setup,
5761
+ getProtocol,
5762
+ isXHRSupported,
5763
+ getLocalStorage,
5764
+ createXHR,
5765
+ createWebSocket,
5766
+ addUnloadListener,
5767
+ removeUnloadListener,
5768
+ transportConnectionInitializer,
5769
+ createSocketRequest,
5770
+ HTTPFactory,
6118
5771
  TimelineTransport: fetch_timeline,
6119
- getAuthorizers: function () {
5772
+ getAuthorizers() {
6120
5773
  return { ajax: fetch_auth };
6121
5774
  },
6122
- getWebSocketAPI: function () {
5775
+ getWebSocketAPI() {
6123
5776
  return WebSocket;
6124
5777
  },
6125
- getXHRAPI: function () {
5778
+ getXHRAPI() {
6126
5779
  return XMLHttpRequest;
6127
5780
  },
6128
- getNetwork: function () {
5781
+ getNetwork() {
6129
5782
  return net_info_Network;
6130
5783
  },
6131
- randomInt: function (max) {
6132
- var random = function () {
6133
- var crypto = globalThis.crypto || globalThis['msCrypto'];
6134
- var random = crypto.getRandomValues(new Uint32Array(1))[0];
5784
+ randomInt(max) {
5785
+ const random = function () {
5786
+ const crypto = globalThis.crypto || globalThis['msCrypto'];
5787
+ const random = crypto.getRandomValues(new Uint32Array(1))[0];
6135
5788
  return random / Math.pow(2, 32);
6136
5789
  };
6137
5790
  return Math.floor(random() * max);
@@ -6152,8 +5805,8 @@ var TimelineLevel;
6152
5805
 
6153
5806
 
6154
5807
 
6155
- var timeline_Timeline = (function () {
6156
- function Timeline(key, session, options) {
5808
+ class timeline_Timeline {
5809
+ constructor(key, session, options) {
6157
5810
  this.key = key;
6158
5811
  this.session = session;
6159
5812
  this.events = [];
@@ -6161,28 +5814,27 @@ var timeline_Timeline = (function () {
6161
5814
  this.sent = 0;
6162
5815
  this.uniqueID = 0;
6163
5816
  }
6164
- Timeline.prototype.log = function (level, event) {
5817
+ log(level, event) {
6165
5818
  if (level <= this.options.level) {
6166
5819
  this.events.push(extend({}, event, { timestamp: util.now() }));
6167
5820
  if (this.options.limit && this.events.length > this.options.limit) {
6168
5821
  this.events.shift();
6169
5822
  }
6170
5823
  }
6171
- };
6172
- Timeline.prototype.error = function (event) {
5824
+ }
5825
+ error(event) {
6173
5826
  this.log(timeline_level.ERROR, event);
6174
- };
6175
- Timeline.prototype.info = function (event) {
5827
+ }
5828
+ info(event) {
6176
5829
  this.log(timeline_level.INFO, event);
6177
- };
6178
- Timeline.prototype.debug = function (event) {
5830
+ }
5831
+ debug(event) {
6179
5832
  this.log(timeline_level.DEBUG, event);
6180
- };
6181
- Timeline.prototype.isEmpty = function () {
5833
+ }
5834
+ isEmpty() {
6182
5835
  return this.events.length === 0;
6183
- };
6184
- Timeline.prototype.send = function (sendfn, callback) {
6185
- var _this = this;
5836
+ }
5837
+ send(sendfn, callback) {
6186
5838
  var data = extend({
6187
5839
  session: this.session,
6188
5840
  bundle: this.sent + 1,
@@ -6194,43 +5846,40 @@ var timeline_Timeline = (function () {
6194
5846
  timeline: this.events
6195
5847
  }, this.options.params);
6196
5848
  this.events = [];
6197
- sendfn(data, function (error, result) {
5849
+ sendfn(data, (error, result) => {
6198
5850
  if (!error) {
6199
- _this.sent++;
5851
+ this.sent++;
6200
5852
  }
6201
5853
  if (callback) {
6202
5854
  callback(error, result);
6203
5855
  }
6204
5856
  });
6205
5857
  return true;
6206
- };
6207
- Timeline.prototype.generateUniqueID = function () {
5858
+ }
5859
+ generateUniqueID() {
6208
5860
  this.uniqueID++;
6209
5861
  return this.uniqueID;
6210
- };
6211
- return Timeline;
6212
- }());
6213
- /* harmony default export */ var timeline_timeline = (timeline_Timeline);
5862
+ }
5863
+ }
6214
5864
 
6215
5865
  // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
6216
5866
 
6217
5867
 
6218
5868
 
6219
5869
 
6220
- var transport_strategy_TransportStrategy = (function () {
6221
- function TransportStrategy(name, priority, transport, options) {
5870
+ class transport_strategy_TransportStrategy {
5871
+ constructor(name, priority, transport, options) {
6222
5872
  this.name = name;
6223
5873
  this.priority = priority;
6224
5874
  this.transport = transport;
6225
5875
  this.options = options || {};
6226
5876
  }
6227
- TransportStrategy.prototype.isSupported = function () {
5877
+ isSupported() {
6228
5878
  return this.transport.isSupported({
6229
5879
  useTLS: this.options.useTLS
6230
5880
  });
6231
- };
6232
- TransportStrategy.prototype.connect = function (minPriority, callback) {
6233
- var _this = this;
5881
+ }
5882
+ connect(minPriority, callback) {
6234
5883
  if (!this.isSupported()) {
6235
5884
  return failAttempt(new UnsupportedStrategy(), callback);
6236
5885
  }
@@ -6273,7 +5922,7 @@ var transport_strategy_TransportStrategy = (function () {
6273
5922
  transport.bind('closed', onClosed);
6274
5923
  transport.initialize();
6275
5924
  return {
6276
- abort: function () {
5925
+ abort: () => {
6277
5926
  if (connected) {
6278
5927
  return;
6279
5928
  }
@@ -6285,11 +5934,11 @@ var transport_strategy_TransportStrategy = (function () {
6285
5934
  transport.close();
6286
5935
  }
6287
5936
  },
6288
- forceMinPriority: function (p) {
5937
+ forceMinPriority: p => {
6289
5938
  if (connected) {
6290
5939
  return;
6291
5940
  }
6292
- if (_this.priority < p) {
5941
+ if (this.priority < p) {
6293
5942
  if (handshake) {
6294
5943
  handshake.close();
6295
5944
  }
@@ -6299,10 +5948,8 @@ var transport_strategy_TransportStrategy = (function () {
6299
5948
  }
6300
5949
  }
6301
5950
  };
6302
- };
6303
- return TransportStrategy;
6304
- }());
6305
- /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
5951
+ }
5952
+ }
6306
5953
  function failAttempt(error, callback) {
6307
5954
  util.defer(function () {
6308
5955
  callback(error);
@@ -6319,7 +5966,7 @@ function failAttempt(error, callback) {
6319
5966
 
6320
5967
 
6321
5968
 
6322
- var strategy_builder_Transports = worker_runtime.Transports;
5969
+ const { Transports: strategy_builder_Transports } = worker_runtime;
6323
5970
  var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
6324
5971
  var transportClass = strategy_builder_Transports[type];
6325
5972
  if (!transportClass) {
@@ -6332,7 +5979,7 @@ var strategy_builder_defineTransport = function (config, name, type, priority, o
6332
5979
  var transport;
6333
5980
  if (enabled) {
6334
5981
  options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
6335
- transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
5982
+ transport = new transport_strategy_TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
6336
5983
  }
6337
5984
  else {
6338
5985
  transport = strategy_builder_UnsupportedStrategy;
@@ -6380,7 +6027,7 @@ var AuthRequestType;
6380
6027
  // CONCATENATED MODULE: ./src/core/auth/user_authenticator.ts
6381
6028
 
6382
6029
 
6383
- var composeChannelQuery = function (params, authOptions) {
6030
+ const composeChannelQuery = (params, authOptions) => {
6384
6031
  var query = 'socket_id=' + encodeURIComponent(params.socketId);
6385
6032
  for (var key in authOptions.params) {
6386
6033
  query +=
@@ -6390,7 +6037,7 @@ var composeChannelQuery = function (params, authOptions) {
6390
6037
  encodeURIComponent(authOptions.params[key]);
6391
6038
  }
6392
6039
  if (authOptions.paramsProvider != null) {
6393
- var dynamicParams = authOptions.paramsProvider();
6040
+ let dynamicParams = authOptions.paramsProvider();
6394
6041
  for (var key in dynamicParams) {
6395
6042
  query +=
6396
6043
  '&' +
@@ -6401,12 +6048,12 @@ var composeChannelQuery = function (params, authOptions) {
6401
6048
  }
6402
6049
  return query;
6403
6050
  };
6404
- var UserAuthenticator = function (authOptions) {
6051
+ const UserAuthenticator = (authOptions) => {
6405
6052
  if (typeof worker_runtime.getAuthorizers()[authOptions.transport] === 'undefined') {
6406
- throw "'" + authOptions.transport + "' is not a recognized auth transport";
6053
+ throw `'${authOptions.transport}' is not a recognized auth transport`;
6407
6054
  }
6408
- return function (params, callback) {
6409
- var query = composeChannelQuery(params, authOptions);
6055
+ return (params, callback) => {
6056
+ const query = composeChannelQuery(params, authOptions);
6410
6057
  worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
6411
6058
  };
6412
6059
  };
@@ -6415,7 +6062,7 @@ var UserAuthenticator = function (authOptions) {
6415
6062
  // CONCATENATED MODULE: ./src/core/auth/channel_authorizer.ts
6416
6063
 
6417
6064
 
6418
- var channel_authorizer_composeChannelQuery = function (params, authOptions) {
6065
+ const channel_authorizer_composeChannelQuery = (params, authOptions) => {
6419
6066
  var query = 'socket_id=' + encodeURIComponent(params.socketId);
6420
6067
  query += '&channel_name=' + encodeURIComponent(params.channelName);
6421
6068
  for (var key in authOptions.params) {
@@ -6426,7 +6073,7 @@ var channel_authorizer_composeChannelQuery = function (params, authOptions) {
6426
6073
  encodeURIComponent(authOptions.params[key]);
6427
6074
  }
6428
6075
  if (authOptions.paramsProvider != null) {
6429
- var dynamicParams = authOptions.paramsProvider();
6076
+ let dynamicParams = authOptions.paramsProvider();
6430
6077
  for (var key in dynamicParams) {
6431
6078
  query +=
6432
6079
  '&' +
@@ -6437,20 +6084,20 @@ var channel_authorizer_composeChannelQuery = function (params, authOptions) {
6437
6084
  }
6438
6085
  return query;
6439
6086
  };
6440
- var ChannelAuthorizer = function (authOptions) {
6087
+ const ChannelAuthorizer = (authOptions) => {
6441
6088
  if (typeof worker_runtime.getAuthorizers()[authOptions.transport] === 'undefined') {
6442
- throw "'" + authOptions.transport + "' is not a recognized auth transport";
6089
+ throw `'${authOptions.transport}' is not a recognized auth transport`;
6443
6090
  }
6444
- return function (params, callback) {
6445
- var query = channel_authorizer_composeChannelQuery(params, authOptions);
6091
+ return (params, callback) => {
6092
+ const query = channel_authorizer_composeChannelQuery(params, authOptions);
6446
6093
  worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
6447
6094
  };
6448
6095
  };
6449
6096
  /* harmony default export */ var channel_authorizer = (ChannelAuthorizer);
6450
6097
 
6451
6098
  // CONCATENATED MODULE: ./src/core/auth/deprecated_channel_authorizer.ts
6452
- var ChannelAuthorizerProxy = function (pusher, authOptions, channelAuthorizerGenerator) {
6453
- var deprecatedAuthorizerOptions = {
6099
+ const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator) => {
6100
+ const deprecatedAuthorizerOptions = {
6454
6101
  authTransport: authOptions.transport,
6455
6102
  authEndpoint: authOptions.endpoint,
6456
6103
  auth: {
@@ -6458,32 +6105,21 @@ var ChannelAuthorizerProxy = function (pusher, authOptions, channelAuthorizerGen
6458
6105
  headers: authOptions.headers
6459
6106
  }
6460
6107
  };
6461
- return function (params, callback) {
6462
- var channel = pusher.channel(params.channelName);
6463
- var channelAuthorizer = channelAuthorizerGenerator(channel, deprecatedAuthorizerOptions);
6108
+ return (params, callback) => {
6109
+ const channel = pusher.channel(params.channelName);
6110
+ const channelAuthorizer = channelAuthorizerGenerator(channel, deprecatedAuthorizerOptions);
6464
6111
  channelAuthorizer.authorize(params.socketId, callback);
6465
6112
  };
6466
6113
  };
6467
6114
 
6468
6115
  // CONCATENATED MODULE: ./src/core/config.ts
6469
- var __assign = (undefined && undefined.__assign) || function () {
6470
- __assign = Object.assign || function(t) {
6471
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6472
- s = arguments[i];
6473
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6474
- t[p] = s[p];
6475
- }
6476
- return t;
6477
- };
6478
- return __assign.apply(this, arguments);
6479
- };
6480
6116
 
6481
6117
 
6482
6118
 
6483
6119
 
6484
6120
 
6485
6121
  function getConfig(opts, pusher) {
6486
- var config = {
6122
+ let config = {
6487
6123
  activityTimeout: opts.activityTimeout || defaults.activityTimeout,
6488
6124
  cluster: opts.cluster,
6489
6125
  httpPath: opts.httpPath || defaults.httpPath,
@@ -6520,7 +6156,7 @@ function getHttpHost(opts) {
6520
6156
  return opts.httpHost;
6521
6157
  }
6522
6158
  if (opts.cluster) {
6523
- return "sockjs-" + opts.cluster + ".pusher.com";
6159
+ return `sockjs-${opts.cluster}.pusher.com`;
6524
6160
  }
6525
6161
  return defaults.httpHost;
6526
6162
  }
@@ -6531,7 +6167,7 @@ function getWebsocketHost(opts) {
6531
6167
  return getWebsocketHostFromCluster(opts.cluster);
6532
6168
  }
6533
6169
  function getWebsocketHostFromCluster(cluster) {
6534
- return "ws-" + cluster + ".pusher.com";
6170
+ return `ws-${cluster}.pusher.com`;
6535
6171
  }
6536
6172
  function shouldUseTLS(opts) {
6537
6173
  if (worker_runtime.getProtocol() === 'https:') {
@@ -6552,7 +6188,7 @@ function getEnableStatsConfig(opts) {
6552
6188
  return false;
6553
6189
  }
6554
6190
  function buildUserAuthenticator(opts) {
6555
- var userAuthentication = __assign(__assign({}, defaults.userAuthentication), opts.userAuthentication);
6191
+ const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
6556
6192
  if ('customHandler' in userAuthentication &&
6557
6193
  userAuthentication['customHandler'] != null) {
6558
6194
  return userAuthentication['customHandler'];
@@ -6560,9 +6196,9 @@ function buildUserAuthenticator(opts) {
6560
6196
  return user_authenticator(userAuthentication);
6561
6197
  }
6562
6198
  function buildChannelAuth(opts, pusher) {
6563
- var channelAuthorization;
6199
+ let channelAuthorization;
6564
6200
  if ('channelAuthorization' in opts) {
6565
- channelAuthorization = __assign(__assign({}, defaults.channelAuthorization), opts.channelAuthorization);
6201
+ channelAuthorization = Object.assign(Object.assign({}, defaults.channelAuthorization), opts.channelAuthorization);
6566
6202
  }
6567
6203
  else {
6568
6204
  channelAuthorization = {
@@ -6581,7 +6217,7 @@ function buildChannelAuth(opts, pusher) {
6581
6217
  return channelAuthorization;
6582
6218
  }
6583
6219
  function buildChannelAuthorizer(opts, pusher) {
6584
- var channelAuthorization = buildChannelAuth(opts, pusher);
6220
+ const channelAuthorization = buildChannelAuth(opts, pusher);
6585
6221
  if ('customHandler' in channelAuthorization &&
6586
6222
  channelAuthorization['customHandler'] != null) {
6587
6223
  return channelAuthorization['customHandler'];
@@ -6590,134 +6226,99 @@ function buildChannelAuthorizer(opts, pusher) {
6590
6226
  }
6591
6227
 
6592
6228
  // CONCATENATED MODULE: ./src/core/watchlist.ts
6593
- var watchlist_extends = (undefined && undefined.__extends) || (function () {
6594
- var extendStatics = function (d, b) {
6595
- extendStatics = Object.setPrototypeOf ||
6596
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6597
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6598
- return extendStatics(d, b);
6599
- };
6600
- return function (d, b) {
6601
- extendStatics(d, b);
6602
- function __() { this.constructor = d; }
6603
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6604
- };
6605
- })();
6606
6229
 
6607
6230
 
6608
- var watchlist_WatchlistFacade = (function (_super) {
6609
- watchlist_extends(WatchlistFacade, _super);
6610
- function WatchlistFacade(pusher) {
6611
- var _this = _super.call(this, function (eventName, data) {
6612
- logger.debug("No callbacks on watchlist events for " + eventName);
6613
- }) || this;
6614
- _this.pusher = pusher;
6615
- _this.bindWatchlistInternalEvent();
6616
- return _this;
6617
- }
6618
- WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
6619
- var _this = this;
6620
- pusherEvent.data.events.forEach(function (watchlistEvent) {
6621
- _this.emit(watchlistEvent.name, watchlistEvent);
6231
+ class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
6232
+ constructor(pusher) {
6233
+ super(function (eventName, data) {
6234
+ logger.debug(`No callbacks on watchlist events for ${eventName}`);
6622
6235
  });
6623
- };
6624
- WatchlistFacade.prototype.bindWatchlistInternalEvent = function () {
6625
- var _this = this;
6626
- this.pusher.connection.bind('message', function (pusherEvent) {
6236
+ this.pusher = pusher;
6237
+ this.bindWatchlistInternalEvent();
6238
+ }
6239
+ handleEvent(pusherEvent) {
6240
+ pusherEvent.data.events.forEach(watchlistEvent => {
6241
+ this.emit(watchlistEvent.name, watchlistEvent);
6242
+ });
6243
+ }
6244
+ bindWatchlistInternalEvent() {
6245
+ this.pusher.connection.bind('message', pusherEvent => {
6627
6246
  var eventName = pusherEvent.event;
6628
6247
  if (eventName === 'pusher_internal:watchlist_events') {
6629
- _this.handleEvent(pusherEvent);
6248
+ this.handleEvent(pusherEvent);
6630
6249
  }
6631
6250
  });
6632
- };
6633
- return WatchlistFacade;
6634
- }(dispatcher));
6635
- /* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
6251
+ }
6252
+ }
6636
6253
 
6637
6254
  // CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
6638
6255
  function flatPromise() {
6639
- var resolve, reject;
6640
- var promise = new Promise(function (res, rej) {
6256
+ let resolve, reject;
6257
+ const promise = new Promise((res, rej) => {
6641
6258
  resolve = res;
6642
6259
  reject = rej;
6643
6260
  });
6644
- return { promise: promise, resolve: resolve, reject: reject };
6261
+ return { promise, resolve, reject };
6645
6262
  }
6646
6263
  /* harmony default export */ var flat_promise = (flatPromise);
6647
6264
 
6648
6265
  // CONCATENATED MODULE: ./src/core/user.ts
6649
- var user_extends = (undefined && undefined.__extends) || (function () {
6650
- var extendStatics = function (d, b) {
6651
- extendStatics = Object.setPrototypeOf ||
6652
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6653
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6654
- return extendStatics(d, b);
6655
- };
6656
- return function (d, b) {
6657
- extendStatics(d, b);
6658
- function __() { this.constructor = d; }
6659
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6660
- };
6661
- })();
6662
6266
 
6663
6267
 
6664
6268
 
6665
6269
 
6666
6270
 
6667
- var user_UserFacade = (function (_super) {
6668
- user_extends(UserFacade, _super);
6669
- function UserFacade(pusher) {
6670
- var _this = _super.call(this, function (eventName, data) {
6271
+ class user_UserFacade extends dispatcher_Dispatcher {
6272
+ constructor(pusher) {
6273
+ super(function (eventName, data) {
6671
6274
  logger.debug('No callbacks on user for ' + eventName);
6672
- }) || this;
6673
- _this.signin_requested = false;
6674
- _this.user_data = null;
6675
- _this.serverToUserChannel = null;
6676
- _this.signinDonePromise = null;
6677
- _this._signinDoneResolve = null;
6678
- _this._onAuthorize = function (err, authData) {
6275
+ });
6276
+ this.signin_requested = false;
6277
+ this.user_data = null;
6278
+ this.serverToUserChannel = null;
6279
+ this.signinDonePromise = null;
6280
+ this._signinDoneResolve = null;
6281
+ this._onAuthorize = (err, authData) => {
6679
6282
  if (err) {
6680
- logger.warn("Error during signin: " + err);
6681
- _this._cleanup();
6283
+ logger.warn(`Error during signin: ${err}`);
6284
+ this._cleanup();
6682
6285
  return;
6683
6286
  }
6684
- _this.pusher.send_event('pusher:signin', {
6287
+ this.pusher.send_event('pusher:signin', {
6685
6288
  auth: authData.auth,
6686
6289
  user_data: authData.user_data
6687
6290
  });
6688
6291
  };
6689
- _this.pusher = pusher;
6690
- _this.pusher.connection.bind('state_change', function (_a) {
6691
- var previous = _a.previous, current = _a.current;
6292
+ this.pusher = pusher;
6293
+ this.pusher.connection.bind('state_change', ({ previous, current }) => {
6692
6294
  if (previous !== 'connected' && current === 'connected') {
6693
- _this._signin();
6295
+ this._signin();
6694
6296
  }
6695
6297
  if (previous === 'connected' && current !== 'connected') {
6696
- _this._cleanup();
6697
- _this._newSigninPromiseIfNeeded();
6298
+ this._cleanup();
6299
+ this._newSigninPromiseIfNeeded();
6698
6300
  }
6699
6301
  });
6700
- _this.watchlist = new watchlist(pusher);
6701
- _this.pusher.connection.bind('message', function (event) {
6302
+ this.watchlist = new watchlist_WatchlistFacade(pusher);
6303
+ this.pusher.connection.bind('message', event => {
6702
6304
  var eventName = event.event;
6703
6305
  if (eventName === 'pusher:signin_success') {
6704
- _this._onSigninSuccess(event.data);
6306
+ this._onSigninSuccess(event.data);
6705
6307
  }
6706
- if (_this.serverToUserChannel &&
6707
- _this.serverToUserChannel.name === event.channel) {
6708
- _this.serverToUserChannel.handleEvent(event);
6308
+ if (this.serverToUserChannel &&
6309
+ this.serverToUserChannel.name === event.channel) {
6310
+ this.serverToUserChannel.handleEvent(event);
6709
6311
  }
6710
6312
  });
6711
- return _this;
6712
6313
  }
6713
- UserFacade.prototype.signin = function () {
6314
+ signin() {
6714
6315
  if (this.signin_requested) {
6715
6316
  return;
6716
6317
  }
6717
6318
  this.signin_requested = true;
6718
6319
  this._signin();
6719
- };
6720
- UserFacade.prototype._signin = function () {
6320
+ }
6321
+ _signin() {
6721
6322
  if (!this.signin_requested) {
6722
6323
  return;
6723
6324
  }
@@ -6728,46 +6329,45 @@ var user_UserFacade = (function (_super) {
6728
6329
  this.pusher.config.userAuthenticator({
6729
6330
  socketId: this.pusher.connection.socket_id
6730
6331
  }, this._onAuthorize);
6731
- };
6732
- UserFacade.prototype._onSigninSuccess = function (data) {
6332
+ }
6333
+ _onSigninSuccess(data) {
6733
6334
  try {
6734
6335
  this.user_data = JSON.parse(data.user_data);
6735
6336
  }
6736
6337
  catch (e) {
6737
- logger.error("Failed parsing user data after signin: " + data.user_data);
6338
+ logger.error(`Failed parsing user data after signin: ${data.user_data}`);
6738
6339
  this._cleanup();
6739
6340
  return;
6740
6341
  }
6741
6342
  if (typeof this.user_data.id !== 'string' || this.user_data.id === '') {
6742
- logger.error("user_data doesn't contain an id. user_data: " + this.user_data);
6343
+ logger.error(`user_data doesn't contain an id. user_data: ${this.user_data}`);
6743
6344
  this._cleanup();
6744
6345
  return;
6745
6346
  }
6746
6347
  this._signinDoneResolve();
6747
6348
  this._subscribeChannels();
6748
- };
6749
- UserFacade.prototype._subscribeChannels = function () {
6750
- var _this = this;
6751
- var ensure_subscribed = function (channel) {
6349
+ }
6350
+ _subscribeChannels() {
6351
+ const ensure_subscribed = channel => {
6752
6352
  if (channel.subscriptionPending && channel.subscriptionCancelled) {
6753
6353
  channel.reinstateSubscription();
6754
6354
  }
6755
6355
  else if (!channel.subscriptionPending &&
6756
- _this.pusher.connection.state === 'connected') {
6356
+ this.pusher.connection.state === 'connected') {
6757
6357
  channel.subscribe();
6758
6358
  }
6759
6359
  };
6760
- this.serverToUserChannel = new channels_channel("#server-to-user-" + this.user_data.id, this.pusher);
6761
- this.serverToUserChannel.bind_global(function (eventName, data) {
6360
+ this.serverToUserChannel = new channel_Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
6361
+ this.serverToUserChannel.bind_global((eventName, data) => {
6762
6362
  if (eventName.indexOf('pusher_internal:') === 0 ||
6763
6363
  eventName.indexOf('pusher:') === 0) {
6764
6364
  return;
6765
6365
  }
6766
- _this.emit(eventName, data);
6366
+ this.emit(eventName, data);
6767
6367
  });
6768
6368
  ensure_subscribed(this.serverToUserChannel);
6769
- };
6770
- UserFacade.prototype._cleanup = function () {
6369
+ }
6370
+ _cleanup() {
6771
6371
  this.user_data = null;
6772
6372
  if (this.serverToUserChannel) {
6773
6373
  this.serverToUserChannel.unbind_all();
@@ -6777,26 +6377,24 @@ var user_UserFacade = (function (_super) {
6777
6377
  if (this.signin_requested) {
6778
6378
  this._signinDoneResolve();
6779
6379
  }
6780
- };
6781
- UserFacade.prototype._newSigninPromiseIfNeeded = function () {
6380
+ }
6381
+ _newSigninPromiseIfNeeded() {
6782
6382
  if (!this.signin_requested) {
6783
6383
  return;
6784
6384
  }
6785
6385
  if (this.signinDonePromise && !this.signinDonePromise.done) {
6786
6386
  return;
6787
6387
  }
6788
- var _a = flat_promise(), promise = _a.promise, resolve = _a.resolve, _ = _a.reject;
6388
+ const { promise, resolve, reject: _ } = flat_promise();
6789
6389
  promise.done = false;
6790
- var setDone = function () {
6390
+ const setDone = () => {
6791
6391
  promise.done = true;
6792
6392
  };
6793
- promise.then(setDone)["catch"](setDone);
6393
+ promise.then(setDone).catch(setDone);
6794
6394
  this.signinDonePromise = promise;
6795
6395
  this._signinDoneResolve = resolve;
6796
- };
6797
- return UserFacade;
6798
- }(dispatcher));
6799
- /* harmony default export */ var user = (user_UserFacade);
6396
+ }
6397
+ }
6800
6398
 
6801
6399
  // CONCATENATED MODULE: ./src/core/pusher.ts
6802
6400
 
@@ -6812,19 +6410,29 @@ var user_UserFacade = (function (_super) {
6812
6410
 
6813
6411
 
6814
6412
 
6815
- var pusher_Pusher = (function () {
6816
- function Pusher(app_key, options) {
6817
- var _this = this;
6413
+ class pusher_Pusher {
6414
+ static ready() {
6415
+ pusher_Pusher.isReady = true;
6416
+ for (var i = 0, l = pusher_Pusher.instances.length; i < l; i++) {
6417
+ pusher_Pusher.instances[i].connect();
6418
+ }
6419
+ }
6420
+ static getClientFeatures() {
6421
+ return keys(filterObject({ ws: worker_runtime.Transports.ws }, function (t) {
6422
+ return t.isSupported({});
6423
+ }));
6424
+ }
6425
+ constructor(app_key, options) {
6818
6426
  checkAppKey(app_key);
6819
6427
  validateOptions(options);
6820
6428
  this.key = app_key;
6821
6429
  this.config = getConfig(options, this);
6822
6430
  this.channels = factory.createChannels();
6823
- this.global_emitter = new dispatcher();
6431
+ this.global_emitter = new dispatcher_Dispatcher();
6824
6432
  this.sessionID = worker_runtime.randomInt(1000000000);
6825
- this.timeline = new timeline_timeline(this.key, this.sessionID, {
6433
+ this.timeline = new timeline_Timeline(this.key, this.sessionID, {
6826
6434
  cluster: this.config.cluster,
6827
- features: Pusher.getClientFeatures(),
6435
+ features: pusher_Pusher.getClientFeatures(),
6828
6436
  params: this.config.timelineParams || {},
6829
6437
  limit: 50,
6830
6438
  level: timeline_level.INFO,
@@ -6836,8 +6444,8 @@ var pusher_Pusher = (function () {
6836
6444
  path: '/timeline/v2/' + worker_runtime.TimelineTransport.name
6837
6445
  });
6838
6446
  }
6839
- var getStrategy = function (options) {
6840
- return worker_runtime.getDefaultStrategy(_this.config, options, strategy_builder_defineTransport);
6447
+ var getStrategy = (options) => {
6448
+ return worker_runtime.getDefaultStrategy(this.config, options, strategy_builder_defineTransport);
6841
6449
  };
6842
6450
  this.connection = factory.createConnectionManager(this.key, {
6843
6451
  getStrategy: getStrategy,
@@ -6847,106 +6455,95 @@ var pusher_Pusher = (function () {
6847
6455
  unavailableTimeout: this.config.unavailableTimeout,
6848
6456
  useTLS: Boolean(this.config.useTLS)
6849
6457
  });
6850
- this.connection.bind('connected', function () {
6851
- _this.subscribeAll();
6852
- if (_this.timelineSender) {
6853
- _this.timelineSender.send(_this.connection.isUsingTLS());
6458
+ this.connection.bind('connected', () => {
6459
+ this.subscribeAll();
6460
+ if (this.timelineSender) {
6461
+ this.timelineSender.send(this.connection.isUsingTLS());
6854
6462
  }
6855
6463
  });
6856
- this.connection.bind('message', function (event) {
6464
+ this.connection.bind('message', event => {
6857
6465
  var eventName = event.event;
6858
6466
  var internal = eventName.indexOf('pusher_internal:') === 0;
6859
6467
  if (event.channel) {
6860
- var channel = _this.channel(event.channel);
6468
+ var channel = this.channel(event.channel);
6861
6469
  if (channel) {
6862
6470
  channel.handleEvent(event);
6863
6471
  }
6864
6472
  }
6865
6473
  if (!internal) {
6866
- _this.global_emitter.emit(event.event, event.data);
6474
+ this.global_emitter.emit(event.event, event.data);
6867
6475
  }
6868
6476
  });
6869
- this.connection.bind('connecting', function () {
6870
- _this.channels.disconnect();
6477
+ this.connection.bind('connecting', () => {
6478
+ this.channels.disconnect();
6871
6479
  });
6872
- this.connection.bind('disconnected', function () {
6873
- _this.channels.disconnect();
6480
+ this.connection.bind('disconnected', () => {
6481
+ this.channels.disconnect();
6874
6482
  });
6875
- this.connection.bind('error', function (err) {
6483
+ this.connection.bind('error', err => {
6876
6484
  logger.warn(err);
6877
6485
  });
6878
- Pusher.instances.push(this);
6879
- this.timeline.info({ instances: Pusher.instances.length });
6880
- this.user = new user(this);
6881
- if (Pusher.isReady) {
6486
+ pusher_Pusher.instances.push(this);
6487
+ this.timeline.info({ instances: pusher_Pusher.instances.length });
6488
+ this.user = new user_UserFacade(this);
6489
+ if (pusher_Pusher.isReady) {
6882
6490
  this.connect();
6883
6491
  }
6884
6492
  }
6885
- Pusher.ready = function () {
6886
- Pusher.isReady = true;
6887
- for (var i = 0, l = Pusher.instances.length; i < l; i++) {
6888
- Pusher.instances[i].connect();
6889
- }
6890
- };
6891
- Pusher.getClientFeatures = function () {
6892
- return keys(filterObject({ ws: worker_runtime.Transports.ws }, function (t) {
6893
- return t.isSupported({});
6894
- }));
6895
- };
6896
- Pusher.prototype.channel = function (name) {
6493
+ channel(name) {
6897
6494
  return this.channels.find(name);
6898
- };
6899
- Pusher.prototype.allChannels = function () {
6495
+ }
6496
+ allChannels() {
6900
6497
  return this.channels.all();
6901
- };
6902
- Pusher.prototype.connect = function () {
6498
+ }
6499
+ connect() {
6903
6500
  this.connection.connect();
6904
6501
  if (this.timelineSender) {
6905
6502
  if (!this.timelineSenderTimer) {
6906
6503
  var usingTLS = this.connection.isUsingTLS();
6907
6504
  var timelineSender = this.timelineSender;
6908
- this.timelineSenderTimer = new PeriodicTimer(60000, function () {
6505
+ this.timelineSenderTimer = new timers_PeriodicTimer(60000, function () {
6909
6506
  timelineSender.send(usingTLS);
6910
6507
  });
6911
6508
  }
6912
6509
  }
6913
- };
6914
- Pusher.prototype.disconnect = function () {
6510
+ }
6511
+ disconnect() {
6915
6512
  this.connection.disconnect();
6916
6513
  if (this.timelineSenderTimer) {
6917
6514
  this.timelineSenderTimer.ensureAborted();
6918
6515
  this.timelineSenderTimer = null;
6919
6516
  }
6920
- };
6921
- Pusher.prototype.bind = function (event_name, callback, context) {
6517
+ }
6518
+ bind(event_name, callback, context) {
6922
6519
  this.global_emitter.bind(event_name, callback, context);
6923
6520
  return this;
6924
- };
6925
- Pusher.prototype.unbind = function (event_name, callback, context) {
6521
+ }
6522
+ unbind(event_name, callback, context) {
6926
6523
  this.global_emitter.unbind(event_name, callback, context);
6927
6524
  return this;
6928
- };
6929
- Pusher.prototype.bind_global = function (callback) {
6525
+ }
6526
+ bind_global(callback) {
6930
6527
  this.global_emitter.bind_global(callback);
6931
6528
  return this;
6932
- };
6933
- Pusher.prototype.unbind_global = function (callback) {
6529
+ }
6530
+ unbind_global(callback) {
6934
6531
  this.global_emitter.unbind_global(callback);
6935
6532
  return this;
6936
- };
6937
- Pusher.prototype.unbind_all = function (callback) {
6533
+ }
6534
+ unbind_all(callback) {
6938
6535
  this.global_emitter.unbind_all();
6939
6536
  return this;
6940
- };
6941
- Pusher.prototype.subscribeAll = function () {
6537
+ }
6538
+ subscribeAll() {
6942
6539
  var channelName;
6943
6540
  for (channelName in this.channels.channels) {
6944
6541
  if (this.channels.channels.hasOwnProperty(channelName)) {
6945
6542
  this.subscribe(channelName);
6946
6543
  }
6947
6544
  }
6948
- };
6949
- Pusher.prototype.subscribe = function (channel_name) {
6545
+ }
6546
+ subscribe(channel_name) {
6950
6547
  var channel = this.channels.add(channel_name, this);
6951
6548
  if (channel.subscriptionPending && channel.subscriptionCancelled) {
6952
6549
  channel.reinstateSubscription();
@@ -6956,8 +6553,8 @@ var pusher_Pusher = (function () {
6956
6553
  channel.subscribe();
6957
6554
  }
6958
6555
  return channel;
6959
- };
6960
- Pusher.prototype.unsubscribe = function (channel_name) {
6556
+ }
6557
+ unsubscribe(channel_name) {
6961
6558
  var channel = this.channels.find(channel_name);
6962
6559
  if (channel && channel.subscriptionPending) {
6963
6560
  channel.cancelSubscription();
@@ -6968,25 +6565,24 @@ var pusher_Pusher = (function () {
6968
6565
  channel.unsubscribe();
6969
6566
  }
6970
6567
  }
6971
- };
6972
- Pusher.prototype.send_event = function (event_name, data, channel) {
6568
+ }
6569
+ send_event(event_name, data, channel) {
6973
6570
  return this.connection.send_event(event_name, data, channel);
6974
- };
6975
- Pusher.prototype.shouldUseTLS = function () {
6571
+ }
6572
+ shouldUseTLS() {
6976
6573
  return this.config.useTLS;
6977
- };
6978
- Pusher.prototype.signin = function () {
6574
+ }
6575
+ signin() {
6979
6576
  this.user.signin();
6980
- };
6981
- Pusher.instances = [];
6982
- Pusher.isReady = false;
6983
- Pusher.logToConsole = false;
6984
- Pusher.Runtime = worker_runtime;
6985
- Pusher.ScriptReceivers = worker_runtime.ScriptReceivers;
6986
- Pusher.DependenciesReceivers = worker_runtime.DependenciesReceivers;
6987
- Pusher.auth_callbacks = worker_runtime.auth_callbacks;
6988
- return Pusher;
6989
- }());
6577
+ }
6578
+ }
6579
+ pusher_Pusher.instances = [];
6580
+ pusher_Pusher.isReady = false;
6581
+ pusher_Pusher.logToConsole = false;
6582
+ pusher_Pusher.Runtime = worker_runtime;
6583
+ pusher_Pusher.ScriptReceivers = worker_runtime.ScriptReceivers;
6584
+ pusher_Pusher.DependenciesReceivers = worker_runtime.DependenciesReceivers;
6585
+ pusher_Pusher.auth_callbacks = worker_runtime.auth_callbacks;
6990
6586
  /* harmony default export */ var core_pusher = (pusher_Pusher);
6991
6587
  function checkAppKey(key) {
6992
6588
  if (key === null || key === undefined) {
@@ -6999,36 +6595,18 @@ worker_runtime.setup(pusher_Pusher);
6999
6595
  var nacl_fast = __webpack_require__(2);
7000
6596
 
7001
6597
  // CONCATENATED MODULE: ./src/core/pusher-with-encryption.ts
7002
- var pusher_with_encryption_extends = (undefined && undefined.__extends) || (function () {
7003
- var extendStatics = function (d, b) {
7004
- extendStatics = Object.setPrototypeOf ||
7005
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7006
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7007
- return extendStatics(d, b);
7008
- };
7009
- return function (d, b) {
7010
- extendStatics(d, b);
7011
- function __() { this.constructor = d; }
7012
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7013
- };
7014
- })();
7015
6598
 
7016
6599
 
7017
6600
 
7018
- var pusher_with_encryption_PusherWithEncryption = (function (_super) {
7019
- pusher_with_encryption_extends(PusherWithEncryption, _super);
7020
- function PusherWithEncryption(app_key, options) {
7021
- var _this = this;
7022
- core_pusher.logToConsole = PusherWithEncryption.logToConsole;
7023
- core_pusher.log = PusherWithEncryption.log;
6601
+ class pusher_with_encryption_PusherWithEncryption extends core_pusher {
6602
+ constructor(app_key, options) {
6603
+ core_pusher.logToConsole = pusher_with_encryption_PusherWithEncryption.logToConsole;
6604
+ core_pusher.log = pusher_with_encryption_PusherWithEncryption.log;
7024
6605
  validateOptions(options);
7025
6606
  options.nacl = nacl_fast;
7026
- _this = _super.call(this, app_key, options) || this;
7027
- return _this;
6607
+ super(app_key, options);
7028
6608
  }
7029
- return PusherWithEncryption;
7030
- }(core_pusher));
7031
- /* harmony default export */ var pusher_with_encryption = __webpack_exports__["default"] = (pusher_with_encryption_PusherWithEncryption);
6609
+ }
7032
6610
 
7033
6611
 
7034
6612
  /***/ })