Closed yoshuawuyts closed 8 years ago
I've somehow completely missed this until now - sorry about that! Looks like you've got hooks all figured out in choo now anyway.
:sparkles: haha yeah we should be all sweet - there's still some bugs, but we're churning through them :grin:
Part of the webcomponents spec is about
custom elements
. Event handlers for these elements are part of the specification and are triggered when certain actions occur. Having overlap between the methodsmorphdom
/yo-yo
/choo
use, and what is native to the browser would be neat - less to learn, and in line with the philosophy of not introducing new abstractions on top of the DOM.The
custom elements
events seem to have some overlap in behavior with the currentmorphdom-hooks
api:But the overlap is not complete. There is no equivalent for
.createdCallback()
and.attributeChangedCallback()
; for updates there's only.onupdate()
. So if to mimick thecustom elements
api I'd propose:Which is almost the same, but not entirely. I wonder if this would be a good change.
There's also another alternative, which is to move towards a
.addEventListener()
API, similar in spirit to https://github.com/shama/base-element/issues/7#issuecomment-107649072. This has the benefit of working with existing DOM manipulation libraries, allowing for potentially creative uses to happen:Anyway: I feel there's ways we could expose an API that requires less learning, and feels closer to the browser APIs. Thanks for reading through this wall of text, keen to hear your thoughts. Cheers!