This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeAllEventListeners(eventType) { | |
function removeListeners(element) { | |
const listeners = window.getEventListeners(element); | |
if (!listeners) { | |
return; | |
} | |
for (const type in listeners) { | |
if (eventType && eventType !== type) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('focus', () => { | |
console.log('focused: ', document.activeElement) | |
}, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "evt_XXXXXXXXXXXXXX", | |
"object": "event", | |
"type": "customer.source.expiring", | |
"api_version": "2020-08-27", | |
"created": 1645688110, | |
"request": { | |
"id": null, | |
"idempotency_key": null | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Determines if the array contains duplicate entries. | |
* @param {Array} array | |
* @return {boolean} | |
*/ | |
function hasDuplicate(array) { | |
return array.some((element, index, array) => { | |
return array.indexOf(element) !== index; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const canUseDOM = () => ( | |
typeof window !== 'undefined' && | |
typeof window.document !== 'undefined' && | |
typeof window.document.createElement !== 'undefined' | |
); | |
function elementsWithScrolls() { | |
if (!canUseDOM()) { | |
return; | |
} |