Re:Show HN: Web-directive.js – A directive pattern for nativ...
by mock-possum on Sunday October 19, 2025 @02:07PM
(#45636427)
This looks kinda neat - I’m not really sure I have a good sense of what I would use this for though.
If I’m working in vanilla js, I don’t really have any issues when using element selectors - deferred or otherwise.
If I’m working in an app framework, then that framework already provides this functionality - for instance Lit lets you bind event listeners to elements as defined in your templates @event-name=${this.onEventName}
I guess - is the aim with this, that it’s useful for if you’re working outside the context of a specific site or project, and aiming to write code for an npm package or similar, where you need something portable and framework-independent? I suppose I could see reaching for it in that case.
If I’m working in vanilla js, I don’t really have any issues when using element selectors - deferred or otherwise.
If I’m working in an app framework, then that framework already provides this functionality - for instance Lit lets you bind event listeners to elements as defined in your templates @event-name=${this.onEventName}
I guess - is the aim with this, that it’s useful for if you’re working outside the context of a specific site or project, and aiming to write code for an npm package or similar, where you need something portable and framework-independent? I suppose I could see reaching for it in that case.