@firebase/database 0.12.8 → 0.13.0-20220505222723

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.
@@ -2221,6 +2221,17 @@ var TransportManager = /** @class */ (function () {
2221
2221
  enumerable: false,
2222
2222
  configurable: true
2223
2223
  });
2224
+ Object.defineProperty(TransportManager, "IS_TRANSPORT_INITIALIZED", {
2225
+ /**
2226
+ * Returns whether transport has been selected to ensure WebSocketConnection or BrowserPollConnection are not called after
2227
+ * TransportManager has already set up transports_
2228
+ */
2229
+ get: function () {
2230
+ return this.globalTransportInitialized_;
2231
+ },
2232
+ enumerable: false,
2233
+ configurable: true
2234
+ });
2224
2235
  TransportManager.prototype.initTransports_ = function (repoInfo) {
2225
2236
  var e_1, _a;
2226
2237
  var isWebSocketsAvailable = WebSocketConnection && WebSocketConnection['isAvailable']();
@@ -2251,6 +2262,7 @@ var TransportManager = /** @class */ (function () {
2251
2262
  }
2252
2263
  finally { if (e_1) throw e_1.error; }
2253
2264
  }
2265
+ TransportManager.globalTransportInitialized_ = true;
2254
2266
  }
2255
2267
  };
2256
2268
  /**
@@ -2275,6 +2287,8 @@ var TransportManager = /** @class */ (function () {
2275
2287
  return null;
2276
2288
  }
2277
2289
  };
2290
+ // Keeps track of whether the TransportManager has already chosen a transport to use
2291
+ TransportManager.globalTransportInitialized_ = false;
2278
2292
  return TransportManager;
2279
2293
  }());
2280
2294
 
@@ -14125,6 +14139,26 @@ var Database = /** @class */ (function () {
14125
14139
  };
14126
14140
  return Database;
14127
14141
  }());
14142
+ function checkTransportInit() {
14143
+ if (TransportManager.IS_TRANSPORT_INITIALIZED) {
14144
+ warn('Transport has already been initialized. Please call this function before calling ref or setting up a listener');
14145
+ }
14146
+ }
14147
+ /**
14148
+ * Force the use of websockets instead of longPolling.
14149
+ */
14150
+ function forceWebSockets() {
14151
+ checkTransportInit();
14152
+ BrowserPollConnection.forceDisallow();
14153
+ }
14154
+ /**
14155
+ * Force the use of longPolling instead of websockets. This will be ignored if websocket protocol is used in databaseURL.
14156
+ */
14157
+ function forceLongPolling() {
14158
+ checkTransportInit();
14159
+ WebSocketConnection.forceDisallow();
14160
+ BrowserPollConnection.forceAllow();
14161
+ }
14128
14162
  /**
14129
14163
  * Modify the provided instance to communicate with the Realtime Database
14130
14164
  * emulator.
@@ -14432,6 +14466,8 @@ exports.enableLogging = enableLogging;
14432
14466
  exports.endAt = endAt;
14433
14467
  exports.endBefore = endBefore;
14434
14468
  exports.equalTo = equalTo;
14469
+ exports.forceLongPolling = forceLongPolling;
14470
+ exports.forceWebSockets = forceWebSockets;
14435
14471
  exports.get = get;
14436
14472
  exports.goOffline = goOffline;
14437
14473
  exports.goOnline = goOnline;