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