Skip to content

Instantly share code, notes, and snippets.

@tubbo
Created April 4, 2020 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tubbo/45a0beeb24a7e515897da501a381d7f8 to your computer and use it in GitHub Desktop.
Save tubbo/45a0beeb24a7e515897da501a381d7f8 to your computer and use it in GitHub Desktop.
new syntax for changing how this-binding to functions works. just an idea for now.
class App {
ready() {
alert("hello")
}
}
const app = new App()
document.addEventListener("DOMContentLoaded", app.ready.bind(app))
// or
document.addEventListener("DOMContentLoaded", () => app.ready())
class App {
ready() {
alert("hello")
}
}
const app = new App()
document.addEventListener("DOMContentLoaded", app->ready)
@romanwbruce
Copy link

Meh, nothing special.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment