Closed bigopon closed 7 years ago
Pros
<input keydown.enter.delegate='onSubmit()' />
I think you could do something like: foo.delegate="doSomething() & self"
if you created a SelfBindingBehavior
. Likewise, <input keydown.delegate="onSubmit() & keys:13">
would be possible.
What do you think?
I like the 3 bindings syntax but binding behavior looks more Aurelia to me. Maybe consider making self
binding behavior built in ?
I prefer to go with the binding behavior since it leverages an existing capability and doesn't introduce new syntax.
How would the syntax for keys be like ?
<input keydown.delegate="onSubmit() & keys:13:16:17 "/>
<input keydown.delegate="onSubmit() & keys:'enter':'shift':'ctrl' "/>
<input keydown.delegate="onSubmit() & keys:[13,16,17]" />
<input keydown.delegate="onSubmit() & keys:['enter', 'shift', 'ctrl']" />
<!-- or a mix? -->
<input keydown.delegate="onSubmit() & keys:13:'shift':'tab':'ctrl':18 " />
@EisenbergEffect what do you think about the keys
binding behavior ?
edit: I mean should it be built in. If so what should be the syntax ?
I'm not sure if it should be built in yet. It would depend on how large it is perhaps and whether the implementation is generic enough to be used widely. I think the best way to handle this at first is via a plugin. Once it's built that way we can consider whether to build it in somewhere.
Yeah that's what concerned me, it would add around at least 50 lines something. And doesn't seem to be that neccessary.
I was thinking of an Aurelia way that make event handling on self target (event that originates from that target, not its descendants).
Syntax would look like this
Pros & cons
Changes required:
Replace:
With:
Does this look good ?