@phpsandbox/sdk 0.0.23 → 0.0.24

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.
@@ -3072,6 +3072,12 @@ var PHPSandbox = (() => {
3072
3072
  console[level](`[Transport ${timestamp}] ${message}${logData ? "\n" + logData : ""}`);
3073
3073
  }
3074
3074
  }
3075
+ /**
3076
+ * Ensure the websocket is open without requiring an application-level roundtrip.
3077
+ */
3078
+ connect() {
3079
+ return __privateMethod(this, _Transport_instances, connect_fn).call(this);
3080
+ }
3075
3081
  id() {
3076
3082
  return this.clientId;
3077
3083
  }
@@ -3804,39 +3810,37 @@ var PHPSandbox = (() => {
3804
3810
  };
3805
3811
  return inst;
3806
3812
  }
3807
- var EE = mittWithOnce();
3808
3813
  var EventManager = class _EventManager {
3814
+ constructor() {
3815
+ this.emitter = mittWithOnce();
3816
+ }
3809
3817
  listen(event, callback) {
3810
3818
  const dispose = () => {
3811
3819
  this.removeListener(event, callback);
3812
3820
  };
3813
- EE.on(event, callback);
3821
+ this.emitter.on(event, callback);
3814
3822
  return { dispose };
3815
3823
  }
3816
3824
  emit(event, data) {
3817
- EE.emit(event, data);
3825
+ this.emitter.emit(event, data);
3818
3826
  }
3819
3827
  once(event, callback) {
3820
- EE.once(event, callback);
3828
+ this.emitter.once(event, callback);
3821
3829
  }
3822
3830
  static make() {
3823
- return _EventManager.instance || (_EventManager.instance = new _EventManager());
3831
+ return new _EventManager();
3824
3832
  }
3825
3833
  static refresh() {
3826
- EE.all.clear();
3827
- EE = mittWithOnce();
3828
- return _EventManager.instance = new _EventManager();
3834
+ return new _EventManager();
3829
3835
  }
3830
3836
  removeListener(event, callbackSignature) {
3831
- EE.off(event, callbackSignature);
3837
+ this.emitter.off(event, callbackSignature);
3832
3838
  }
3833
3839
  static createInstance() {
3834
- EE = mittWithOnce();
3835
- _EventManager.instance = new _EventManager();
3836
- return _EventManager.instance;
3840
+ return new _EventManager();
3837
3841
  }
3838
3842
  inspect() {
3839
- return EE.all;
3843
+ return this.emitter.all;
3840
3844
  }
3841
3845
  };
3842
3846
 
@@ -4716,7 +4720,7 @@ var PHPSandbox = (() => {
4716
4720
  async ready() {
4717
4721
  const ready = async () => {
4718
4722
  if (this.client.options.startClosed && !this.socket.isConnected) {
4719
- await this.socket.invoke("ping");
4723
+ await this.socket.connect();
4720
4724
  }
4721
4725
  return __privateGet(this, _initPromise);
4722
4726
  };