@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.
@@ -1294,7 +1294,7 @@ var WebSocketConnection = /** @class */ (function () {
1294
1294
  }());
1295
1295
 
1296
1296
  var name = "@firebase/database";
1297
- var version = "0.12.8";
1297
+ var version = "0.13.0-20220505222723";
1298
1298
 
1299
1299
  /**
1300
1300
  * @license
@@ -2226,6 +2226,17 @@ var TransportManager = /** @class */ (function () {
2226
2226
  enumerable: false,
2227
2227
  configurable: true
2228
2228
  });
2229
+ Object.defineProperty(TransportManager, "IS_TRANSPORT_INITIALIZED", {
2230
+ /**
2231
+ * Returns whether transport has been selected to ensure WebSocketConnection or BrowserPollConnection are not called after
2232
+ * TransportManager has already set up transports_
2233
+ */
2234
+ get: function () {
2235
+ return this.globalTransportInitialized_;
2236
+ },
2237
+ enumerable: false,
2238
+ configurable: true
2239
+ });
2229
2240
  TransportManager.prototype.initTransports_ = function (repoInfo) {
2230
2241
  var e_1, _a;
2231
2242
  var isWebSocketsAvailable = WebSocketConnection && WebSocketConnection['isAvailable']();
@@ -2256,6 +2267,7 @@ var TransportManager = /** @class */ (function () {
2256
2267
  }
2257
2268
  finally { if (e_1) throw e_1.error; }
2258
2269
  }
2270
+ TransportManager.globalTransportInitialized_ = true;
2259
2271
  }
2260
2272
  };
2261
2273
  /**
@@ -2280,6 +2292,8 @@ var TransportManager = /** @class */ (function () {
2280
2292
  return null;
2281
2293
  }
2282
2294
  };
2295
+ // Keeps track of whether the TransportManager has already chosen a transport to use
2296
+ TransportManager.globalTransportInitialized_ = false;
2283
2297
  return TransportManager;
2284
2298
  }());
2285
2299
 
@@ -14130,6 +14144,26 @@ var Database = /** @class */ (function () {
14130
14144
  };
14131
14145
  return Database;
14132
14146
  }());
14147
+ function checkTransportInit() {
14148
+ if (TransportManager.IS_TRANSPORT_INITIALIZED) {
14149
+ warn('Transport has already been initialized. Please call this function before calling ref or setting up a listener');
14150
+ }
14151
+ }
14152
+ /**
14153
+ * Force the use of websockets instead of longPolling.
14154
+ */
14155
+ function forceWebSockets() {
14156
+ checkTransportInit();
14157
+ BrowserPollConnection.forceDisallow();
14158
+ }
14159
+ /**
14160
+ * Force the use of longPolling instead of websockets. This will be ignored if websocket protocol is used in databaseURL.
14161
+ */
14162
+ function forceLongPolling() {
14163
+ checkTransportInit();
14164
+ WebSocketConnection.forceDisallow();
14165
+ BrowserPollConnection.forceAllow();
14166
+ }
14133
14167
  /**
14134
14168
  * Returns the instance of the Realtime Database SDK that is associated
14135
14169
  * with the provided {@link @firebase/app#FirebaseApp}. Initializes a new instance with
@@ -14486,6 +14520,8 @@ exports.enableLogging = enableLogging;
14486
14520
  exports.endAt = endAt;
14487
14521
  exports.endBefore = endBefore;
14488
14522
  exports.equalTo = equalTo;
14523
+ exports.forceLongPolling = forceLongPolling;
14524
+ exports.forceWebSockets = forceWebSockets;
14489
14525
  exports.get = get;
14490
14526
  exports.getDatabase = getDatabase;
14491
14527
  exports.goOffline = goOffline;