@quietsapa/qsl 0.1.1 → 0.1.2
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.
- package/CHANGELOG.md +18 -1
- package/README.md +54 -0
- package/dist/qsl.min.js +1 -1
- package/dist/qsl.min.js.map +1 -1
- package/dist/qsl.mjs +3 -2
- package/dist/qsl.mjs.map +1 -1
- package/dist/qsl.slim.min.js +1 -1
- package/dist/qsl.slim.min.js.map +1 -1
- package/package.json +1 -1
- package/src/core.js +4 -2
package/dist/qsl.mjs
CHANGED
|
@@ -2,7 +2,7 @@ const core = {
|
|
|
2
2
|
/**
|
|
3
3
|
* Constants
|
|
4
4
|
*/
|
|
5
|
-
VERSION: "0.1.
|
|
5
|
+
VERSION: "0.1.2",
|
|
6
6
|
PREFIX: "qsl-",
|
|
7
7
|
FLOW_TYPE: {
|
|
8
8
|
DEFAULT: "default",
|
|
@@ -108,6 +108,7 @@ const core = {
|
|
|
108
108
|
*/
|
|
109
109
|
async init() {
|
|
110
110
|
if (this.initialized) return this;
|
|
111
|
+
const loaderScript = document.currentScript;
|
|
111
112
|
window.__QSL__ = window.__QSL__ || this;
|
|
112
113
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
113
114
|
this.LIFECYCLE.DOMREADY = true;
|
|
@@ -139,7 +140,7 @@ const core = {
|
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
this.initialized = true;
|
|
142
|
-
const url =
|
|
143
|
+
const url = loaderScript && loaderScript.src ? new URL(loaderScript.src, document.baseURI) : null;
|
|
143
144
|
if (!url || url.searchParams.get("async") !== "true") return this;
|
|
144
145
|
const callback = url.searchParams.get("callback") || this.CALLBACK;
|
|
145
146
|
if (typeof window[callback] === "function") window[callback]();
|