saloe 0.0.41 → 0.0.43
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/dist/listener.cjs.js +13 -7
- package/dist/listener.es.js +13 -7
- package/package.json +1 -1
- package/src/listener.js +22 -4
package/dist/listener.cjs.js
CHANGED
|
@@ -156,11 +156,6 @@ const listener = ({
|
|
|
156
156
|
const fireListeners = () => {
|
|
157
157
|
EVENTS.forEach((event) => {
|
|
158
158
|
document.body[`on${event}`] = async (e) => {
|
|
159
|
-
if (EVENTS_FIRE_DOCUMENT_BODY_LISTENERS.includes(event)) {
|
|
160
|
-
await addScripts();
|
|
161
|
-
fireLoadListener();
|
|
162
|
-
fireObserverListeners();
|
|
163
|
-
}
|
|
164
159
|
const srcElement = getSrcElement({ srcElement: e == null ? void 0 : e.srcElement, event });
|
|
165
160
|
const listeners = await fetchListeners({ srcElement, event, e });
|
|
166
161
|
executeListeners({ e, srcElement, listeners });
|
|
@@ -168,12 +163,23 @@ const listener = ({
|
|
|
168
163
|
if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
|
|
169
164
|
};
|
|
170
165
|
});
|
|
166
|
+
const customListenEvent = new customListenEvent("customListenEvent", {
|
|
167
|
+
detail: { message: "This is a custom event!" }
|
|
168
|
+
});
|
|
169
|
+
document.body.addEventListener("customListenEvent", async (event) => {
|
|
170
|
+
await addScripts();
|
|
171
|
+
fireLoadListener();
|
|
172
|
+
console.log("--- event =", event);
|
|
173
|
+
fireObserverListeners();
|
|
174
|
+
});
|
|
175
|
+
document.body.customListenEvent = function() {
|
|
176
|
+
document.body.dispatchEvent(customListenEvent);
|
|
177
|
+
};
|
|
171
178
|
};
|
|
172
179
|
fireListeners();
|
|
173
180
|
window.onload = () => {
|
|
174
181
|
setTimeout(() => {
|
|
175
|
-
|
|
176
|
-
(_a = document == null ? void 0 : document.body) == null ? void 0 : _a.click();
|
|
182
|
+
document.body.customListenEvent();
|
|
177
183
|
}, 2500);
|
|
178
184
|
};
|
|
179
185
|
};
|
package/dist/listener.es.js
CHANGED
|
@@ -154,11 +154,6 @@ const listener = ({
|
|
|
154
154
|
const fireListeners = () => {
|
|
155
155
|
EVENTS.forEach((event) => {
|
|
156
156
|
document.body[`on${event}`] = async (e) => {
|
|
157
|
-
if (EVENTS_FIRE_DOCUMENT_BODY_LISTENERS.includes(event)) {
|
|
158
|
-
await addScripts();
|
|
159
|
-
fireLoadListener();
|
|
160
|
-
fireObserverListeners();
|
|
161
|
-
}
|
|
162
157
|
const srcElement = getSrcElement({ srcElement: e == null ? void 0 : e.srcElement, event });
|
|
163
158
|
const listeners = await fetchListeners({ srcElement, event, e });
|
|
164
159
|
executeListeners({ e, srcElement, listeners });
|
|
@@ -166,12 +161,23 @@ const listener = ({
|
|
|
166
161
|
if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
|
|
167
162
|
};
|
|
168
163
|
});
|
|
164
|
+
const customListenEvent = new customListenEvent("customListenEvent", {
|
|
165
|
+
detail: { message: "This is a custom event!" }
|
|
166
|
+
});
|
|
167
|
+
document.body.addEventListener("customListenEvent", async (event) => {
|
|
168
|
+
await addScripts();
|
|
169
|
+
fireLoadListener();
|
|
170
|
+
console.log("--- event =", event);
|
|
171
|
+
fireObserverListeners();
|
|
172
|
+
});
|
|
173
|
+
document.body.customListenEvent = function() {
|
|
174
|
+
document.body.dispatchEvent(customListenEvent);
|
|
175
|
+
};
|
|
169
176
|
};
|
|
170
177
|
fireListeners();
|
|
171
178
|
window.onload = () => {
|
|
172
179
|
setTimeout(() => {
|
|
173
|
-
|
|
174
|
-
(_a = document == null ? void 0 : document.body) == null ? void 0 : _a.click();
|
|
180
|
+
document.body.customListenEvent();
|
|
175
181
|
}, 2500);
|
|
176
182
|
};
|
|
177
183
|
};
|
package/package.json
CHANGED
package/src/listener.js
CHANGED
|
@@ -226,9 +226,10 @@ const listener = ({
|
|
|
226
226
|
EVENTS.forEach((event) => {
|
|
227
227
|
document.body[`on${event}`] = async (e) => {
|
|
228
228
|
if (EVENTS_FIRE_DOCUMENT_BODY_LISTENERS.includes(event)){
|
|
229
|
-
await addScripts()
|
|
230
|
-
fireLoadListener()
|
|
231
|
-
|
|
229
|
+
// await addScripts()
|
|
230
|
+
// fireLoadListener()
|
|
231
|
+
// console.log('--- event =', event)
|
|
232
|
+
// fireObserverListeners()
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
const srcElement = getSrcElement({ srcElement: e?.srcElement, event })
|
|
@@ -240,13 +241,30 @@ const listener = ({
|
|
|
240
241
|
if (srcElement?.removeAttribute) srcElement.removeAttribute(`on-${event}`)
|
|
241
242
|
}
|
|
242
243
|
})
|
|
244
|
+
|
|
245
|
+
const customListenEvent = new customListenEvent('customListenEvent', {
|
|
246
|
+
detail: { message: 'This is a custom event!' }
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
document.body.addEventListener('customListenEvent', async (event) => {
|
|
250
|
+
await addScripts()
|
|
251
|
+
fireLoadListener()
|
|
252
|
+
console.log('--- event =', event)
|
|
253
|
+
fireObserverListeners()
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
document.body.customListenEvent = function () {
|
|
257
|
+
document.body.dispatchEvent(customListenEvent)
|
|
258
|
+
}
|
|
259
|
+
|
|
243
260
|
}
|
|
244
261
|
|
|
245
262
|
fireListeners()
|
|
246
263
|
|
|
247
264
|
window.onload = () => {
|
|
248
265
|
setTimeout(() => {
|
|
249
|
-
document?.body?.click()
|
|
266
|
+
// document?.body?.click()
|
|
267
|
+
document.body.customListenEvent()
|
|
250
268
|
}, 2_500)
|
|
251
269
|
}
|
|
252
270
|
}
|