riganti / dotvvm

Open source MVVM framework for Web Apps
https://www.dotvvm.com
Apache License 2.0
743 stars 97 forks source link

dot:Events control #1543

Open martindybal opened 1 year ago

martindybal commented 1 year ago

Occasionally I need to respond to a DotVVM event. https://www.dotvvm.com/docs/4.0/pages/concepts/client-side-development/dotvvm-javascript-events. I would like to have that option directly from dothtml.

My suggestion is to add a dot:Event control

<dot:event Name="SpaNavigationFailed" Command="{ staticCommand: showNavigationFailed = true}"}
exyi commented 1 year ago

This is a good idea, IMHO.

It's not entirely trivial, we'll need to add a knockout handler to register and unregister those events to correctly handle usage in client-side Repeater (otherwise, the control is unusable in markup controls)

I'd prefer the following syntax for brevity and easier type checking.

<dot:Events SpaNavigationFailed="{ staticCommand: showNavigationFailed = true}"} />
martindybal commented 1 year ago

I like your idea.

<dot:Events SpaNavigationFailed="{ staticCommand: showNavigationFailed = true}"} />

martindybal commented 1 year ago

@exyi any progress?