web-manager 2.1.26 → 2.1.27

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.
Files changed (2) hide show
  1. package/index.js +53 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -536,6 +536,7 @@ function Manager() {
536
536
  libraries: {
537
537
  firebase_app: {
538
538
  enabled: true,
539
+ load: false,
539
540
  config: {
540
541
  apiKey: '',
541
542
  authDomain: '',
@@ -547,13 +548,16 @@ function Manager() {
547
548
  }
548
549
  },
549
550
  firebase_firestore: {
550
- enabled: true
551
+ enabled: true,
552
+ load: false,
551
553
  },
552
554
  firebase_messaging: {
553
- enabled: true
555
+ enabled: true,
556
+ load: false,
554
557
  },
555
558
  firebase_auth: {
556
559
  enabled: true,
560
+ load: false,
557
561
  },
558
562
  lazysizes: {
559
563
  enabled: true
@@ -1212,12 +1216,11 @@ function Manager() {
1212
1216
  // if (typeof window.firebase !== 'undefined') {
1213
1217
  // return resolve();
1214
1218
  // }
1215
- if (options.libraries.firebase_app.enabled === true) {
1216
- import('firebase/app')
1217
- .then(function(mod) {
1219
+ var setting = options.libraries.firebase_app
1220
+ if (setting.enabled === true) {
1221
+ function _post() {
1218
1222
  // This.log('Loaded Firebase.');
1219
- window.firebase = mod.default;
1220
- window.app = firebase.initializeApp(options.libraries.firebase_app.config);
1223
+ window.app = firebase.initializeApp(setting.config);
1221
1224
 
1222
1225
  Promise.all([
1223
1226
  load_firebase_auth(This, options),
@@ -1226,8 +1229,19 @@ function Manager() {
1226
1229
  ])
1227
1230
  .then(resolve)
1228
1231
  .catch(reject);
1229
- })
1230
- .catch(reject);
1232
+ }
1233
+ if (setting.load) {
1234
+ setting.load()
1235
+ _post()
1236
+ } else {
1237
+ import('firebase/app')
1238
+ .then(function(mod) {
1239
+ window.firebase = mod.default;
1240
+ _post()
1241
+ })
1242
+ .catch(reject);
1243
+ }
1244
+ return resolve()
1231
1245
  } else {
1232
1246
  return resolve();
1233
1247
  }
@@ -1240,10 +1254,16 @@ function Manager() {
1240
1254
  // if (typeof utilities.get(window, 'firebase.auth', undefined) !== 'undefined') {
1241
1255
  // return resolve();
1242
1256
  // }
1243
- if (options.libraries.firebase_auth.enabled === true) {
1244
- import('firebase/auth')
1245
- .then(resolve)
1246
- .catch(reject);
1257
+ var setting = options.libraries.firebase_auth;
1258
+ if (setting.enabled === true) {
1259
+ if (setting.load) {
1260
+ setting.load()
1261
+ resolve()
1262
+ } else {
1263
+ import('firebase/auth')
1264
+ .then(resolve)
1265
+ .catch(reject);
1266
+ }
1247
1267
  } else {
1248
1268
  return resolve();
1249
1269
  }
@@ -1257,10 +1277,16 @@ function Manager() {
1257
1277
  // if (typeof utilities.get(window, 'firebase.firestore', undefined) !== 'undefined') {
1258
1278
  // return resolve();
1259
1279
  // }
1260
- if (options.libraries.firebase_firestore.enabled === true) {
1261
- import('firebase/firestore')
1262
- .then(resolve)
1263
- .catch(reject);
1280
+ var setting = options.libraries.firebase_firestore;
1281
+ if (setting.enabled === true) {
1282
+ if (setting.load) {
1283
+ setting.load()
1284
+ resolve()
1285
+ } else {
1286
+ import('firebase/firestore')
1287
+ .then(resolve)
1288
+ .catch(reject);
1289
+ }
1264
1290
  } else {
1265
1291
  return resolve();
1266
1292
  }
@@ -1272,10 +1298,16 @@ function Manager() {
1272
1298
  // if (typeof utilities.get(window, 'firebase.messaging', undefined) !== 'undefined') {
1273
1299
  // return resolve();
1274
1300
  // }
1275
- if (options.libraries.firebase_messaging.enabled === true) {
1276
- import('firebase/messaging')
1277
- .then(resolve)
1278
- .catch(reject);
1301
+ var setting = options.libraries.firebase_messaging;
1302
+ if (setting.enabled === true) {
1303
+ if (setting.load) {
1304
+ setting.load()
1305
+ resolve()
1306
+ } else {
1307
+ import('firebase/messaging')
1308
+ .then(resolve)
1309
+ .catch(reject);
1310
+ }
1279
1311
  } else {
1280
1312
  return resolve();
1281
1313
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "2.1.26",
3
+ "version": "2.1.27",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "index.js",
6
6
  "scripts": {