how to using js get addEventListener bind events length
how to using js get addEventListener bind events length
const btn = document.querySelector('#btn');
btn.addEventListener('click', () => {
const url = 'http://localhost:9000/api/post';
const obj = {
"user": "1",
"os": "macOS"
};
let data = new URLSearchParams(obj);
navigator.sendBeacon(url, data);
});
btn.addEventListener('click', () => {
const url = 'http://localhost:9000/api/post';
const obj = {
"user": "12",
"os": "macOS"
};
let data = new URLSearchParams(obj);
navigator.sendBeacon(url, data);
});
// ???
btn.eventsLength ?? 0;
addEventListener
target.addEventListener(type, listener);
target.addEventListener(type, listener, options);
target.addEventListener(type, listener, useCapture);
target.addEventListener(type, listener, useCapture, wantsUntrusted); // wantsUntrusted is Firefox only
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
https://www.freecodecamp.org/news/javascript-addeventlistener-example-code/
target.removeEventListener(event, function, useCapture);
visual event
http://www.sprymedia.co.uk/article/Visual+Event
http://www.sprymedia.co.uk/article/Visual+Event+2
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14635737.html
未经授权禁止转载,违者必究!