What I am currently doing when binding same element to multiple actions in knockout is:
data-bind="event: { click: doAction,
touchend : doAction}"
My question is :
Is there some kind of shortcut notation that could be used when binding to actions?
I would expect something like :
data-bind="event: {click, touchend : doAction}"
There is not a built-in shortcut to do this, but it is pretty easy to use a custom binding to make your
data-bindcleaner.There are several approaches that you could take. One solution specific to click and touchend would be:
Then, you would bind against it like:
data-bind="clickAndTouch: doAction"