ManuelDeLeon / viewmodel-react

Create your React components with view models.
MIT License
24 stars 3 forks source link

Focus binding vs. Focus event #46

Closed antoninadert closed 5 years ago

antoninadert commented 5 years ago

Hey, I am not sure what to do since focus bindings exist, but what if I want to attach a function that will get executed on the focus event?

As I understood event work like this: <a b='click:functionName()'>

so for focus event should it be <a b='focus:functionName()'>

but then it is the focus binding, not the focus event...

Some ideas?

ManuelDeLeon commented 5 years ago

Use focus without parentheses, it will call your function when the focus changes, passing a bool parameter.

On Sat, Oct 13, 2018, 5:52 AM Antonin Adert notifications@github.com wrote:

Hey, I am not sure what to do since focus bindings exist, but what if I want to attach a function that will get executed on the focus event?

As I understood event work like this:

so for focus event should it be

but then it is the focus binding, not the focus event...

Some ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ManuelDeLeon/viewmodel-react/issues/46, or mute the thread https://github.com/notifications/unsubscribe-auth/AED31t8tv9x54SP8n-pCUc9xng46g1Asks5ukdPugaJpZM4Xal90 .

antoninadert commented 5 years ago

Thanks so much 💯