Created
July 12, 2024 04:42
-
-
Save davecra/a33636bc52b52b2333b73ad178d24c19 to your computer and use it in GitHub Desktop.
Safari Issue
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
window.setTimeout(async() => { | |
const o = new thing(); | |
await o.render(); | |
}, 1); | |
class thing { | |
render = async () => { | |
const html = /*html*/`<button id="btn1">Test</button>`; | |
document.body.innerHTML = html; | |
const msg = "something here"; | |
document.getElementById("btn1").addEventListener("click", async () => { | |
await this.#getData(msg); | |
}); | |
} | |
#getData = async (msg) => { | |
const result = await fetch('https://jsonplaceholder.typicode.com/posts/1'); | |
console.log(msg); | |
const data = await result.json(); | |
console.log(data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment