Last active
March 16, 2024 02:05
-
-
Save brablc/13d742bdd9cf25977a7eb18d74a4fb14 to your computer and use it in GitHub Desktop.
Diogenes JS
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
<script> | |
function $debug(...args) { | |
console.log('debug', ...args); | |
} | |
function $on(eventName, callback) { | |
document.currentScript.parentElement.addEventListener(eventName, callback); | |
} | |
function $send(element, name, detail) { | |
let event = new CustomEvent(name, { detail: detail, bubbles: true }); | |
element?.dispatchEvent(event); | |
} | |
function $sleep(ms, e) { | |
return new Promise((resolve) => setTimeout(() => resolve(e), ms)); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment