@braintree/asset-loader 1.0.1 → 2.0.0

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.
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- var promise_1 = require("./lib/promise");
3
2
  var scriptPromiseCache = {};
4
3
  function loadScript(options) {
5
4
  var scriptLoadPromise;
@@ -25,7 +24,7 @@ function loadScript(options) {
25
24
  Object.keys(attrs).forEach(function (key) {
26
25
  script.setAttribute("data-".concat(key), "".concat(attrs[key]));
27
26
  });
28
- scriptLoadPromise = new promise_1.PromiseGlobal(function (resolve, reject) {
27
+ scriptLoadPromise = new Promise(function (resolve, reject) {
29
28
  script.addEventListener("load", function () {
30
29
  resolve(script);
31
30
  });
@@ -1,4 +1,3 @@
1
- import { PromiseGlobal as Promise } from "./lib/promise";
2
1
  import { LoadStylesheetOptions } from "./types";
3
2
  declare const _default: (options: LoadStylesheetOptions) => Promise<HTMLLinkElement>;
4
3
  export = _default;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
- var promise_1 = require("./lib/promise");
3
2
  module.exports = function loadStylesheet(options) {
4
3
  var stylesheet = document.querySelector("link[href=\"".concat(options.href, "\"]"));
5
4
  if (stylesheet) {
6
- return promise_1.PromiseGlobal.resolve(stylesheet);
5
+ return Promise.resolve(stylesheet);
7
6
  }
8
7
  stylesheet = document.createElement("link");
9
8
  var container = options.container || document.head;
@@ -17,5 +16,5 @@ module.exports = function loadStylesheet(options) {
17
16
  else {
18
17
  container.appendChild(stylesheet);
19
18
  }
20
- return promise_1.PromiseGlobal.resolve(stylesheet);
19
+ return Promise.resolve(stylesheet);
21
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braintree/asset-loader",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "A module to load frontend assets.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -41,9 +41,7 @@
41
41
  "ts-jest": "^29.1.1",
42
42
  "typescript": "^5.1.6"
43
43
  },
44
- "dependencies": {
45
- "promise-polyfill": "^8.3.0"
46
- },
44
+ "dependencies": {},
47
45
  "jest": {
48
46
  "testEnvironment": "jsdom",
49
47
  "clearMocks": true,
@@ -1,2 +0,0 @@
1
- declare const PromiseGlobal: PromiseConstructor;
2
- export { PromiseGlobal };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PromiseGlobal = void 0;
7
- var promise_polyfill_1 = __importDefault(require("promise-polyfill"));
8
- var PromiseGlobal =
9
- // eslint-disable-next-line no-undef
10
- typeof Promise !== "undefined" ? Promise : promise_polyfill_1.default;
11
- exports.PromiseGlobal = PromiseGlobal;