@quietsapa/qsl 0.1.3 → 0.1.4
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 +24 -1
- package/README.md +5 -13
- package/dist/qsl.min.js +1 -1
- package/dist/qsl.min.js.map +1 -1
- package/dist/qsl.mjs +13 -5
- 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 +7 -1
- package/src/plugins/events.js +26 -4
- package/src/presets/full.js +2 -0
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.4",
|
|
6
6
|
PREFIX: "qsl-",
|
|
7
7
|
FLOW_TYPE: {
|
|
8
8
|
DEFAULT: "default",
|
|
@@ -1527,6 +1527,7 @@ function logger(QSL) {
|
|
|
1527
1527
|
function events(QSL) {
|
|
1528
1528
|
const customEvents = /* @__PURE__ */ new Map();
|
|
1529
1529
|
const processElementMap = /* @__PURE__ */ new WeakMap();
|
|
1530
|
+
let processCounter = 0;
|
|
1530
1531
|
let documentListener = null;
|
|
1531
1532
|
let windowListener = null;
|
|
1532
1533
|
let isIntercepting = false;
|
|
@@ -1538,6 +1539,12 @@ function events(QSL) {
|
|
|
1538
1539
|
return u.split("?")[0].split("#")[0];
|
|
1539
1540
|
}
|
|
1540
1541
|
};
|
|
1542
|
+
const processKey = (process) => {
|
|
1543
|
+
if (!process._eventKey) {
|
|
1544
|
+
process._eventKey = process.id + "#" + ++processCounter;
|
|
1545
|
+
}
|
|
1546
|
+
return process._eventKey;
|
|
1547
|
+
};
|
|
1541
1548
|
QSL.loadActions.add(function() {
|
|
1542
1549
|
if (isIntercepting) return;
|
|
1543
1550
|
documentListener = document.addEventListener;
|
|
@@ -1613,9 +1620,10 @@ function events(QSL) {
|
|
|
1613
1620
|
if (process) {
|
|
1614
1621
|
const shouldFireEvents = process.fireEvents !== false && ((_a = this.flowOptions.get(targetFlowId)) == null ? void 0 : _a.fireEvents) !== false;
|
|
1615
1622
|
if (shouldFireEvents) {
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1618
|
-
|
|
1623
|
+
const key = processKey(process);
|
|
1624
|
+
const eventName = `${type}:${key}`;
|
|
1625
|
+
if (!customEvents.has(key)) customEvents.set(key, []);
|
|
1626
|
+
const events2 = customEvents.get(key);
|
|
1619
1627
|
if (!events2.some((e) => e.name === eventName)) events2.push({ type: eventType, name: eventName });
|
|
1620
1628
|
if (changeEventName) type = eventName;
|
|
1621
1629
|
}
|
|
@@ -1644,7 +1652,7 @@ function events(QSL) {
|
|
|
1644
1652
|
};
|
|
1645
1653
|
});
|
|
1646
1654
|
QSL.processCompleteActions.add(function(process) {
|
|
1647
|
-
const events2 = customEvents.get(process.
|
|
1655
|
+
const events2 = customEvents.get(process._eventKey);
|
|
1648
1656
|
if (events2 && Array.isArray(events2)) {
|
|
1649
1657
|
for (const event of events2) {
|
|
1650
1658
|
if (event.type === this.EVENTS.DOMREADY) {
|