web-manager 2.1.22 → 2.1.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/dom.js +21 -16
  2. package/package.json +2 -2
package/lib/dom.js CHANGED
@@ -250,22 +250,27 @@ Dom.prototype.exists = function() {
250
250
  }
251
251
 
252
252
  Dom.loadScript = function(options, callback) {
253
- options = options || {};
254
- options.async = (typeof options.async === 'undefined') ? false : options.async;
255
- options.crossorigin = (typeof options.crossorigin === 'undefined') ? false : options.crossorigin;
256
- var s = document.createElement('script');
257
- s.src = options.src;
258
- s.async = options.async;
259
- if (options.crossorigin) {
260
- s.setAttribute('crossorigin','*');
261
- }
262
- s.onload = function() {
263
- callback();
264
- };
265
- s.onerror = function() {
266
- callback(new Error('Failed to load script ' + options.src));
267
- };
268
- document.head.appendChild(s);
253
+ return new Promise(function(resolve, reject) {
254
+ options = options || {};
255
+ options.async = (typeof options.async === 'undefined') ? false : options.async;
256
+ options.crossorigin = (typeof options.crossorigin === 'undefined') ? false : options.crossorigin;
257
+ var s = document.createElement('script');
258
+ s.src = options.src;
259
+ s.async = options.async;
260
+ if (options.crossorigin) {
261
+ s.setAttribute('crossorigin','*');
262
+ }
263
+ s.onload = function() {
264
+ callback();
265
+ return resolve();
266
+ };
267
+ s.onerror = function() {
268
+ var error = new Error('Failed to load script ' + options.src);
269
+ callback(error);
270
+ return reject(error);
271
+ };
272
+ document.head.appendChild(s);
273
+ });
269
274
  }
270
275
 
271
276
  Dom.select = function(selector, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "2.1.22",
3
+ "version": "2.1.24",
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": {
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "homepage": "https://itwcreativeworks.com",
25
25
  "dependencies": {
26
- "@sentry/browser": "^6.13.2",
26
+ "@sentry/browser": "^6.15.0",
27
27
  "cookieconsent": "^3.1.1",
28
28
  "firebase": "^8.10.0",
29
29
  "lazysizes": "^5.3.2"