Integration with KnockoutJS?
PhonicUK opened this issue · 1 comments
PhonicUK commented
How can I integrate this with KnockoutJS so that newly created elements via a template get registered and so I can use the force-push event in Knockout binding?
PhonicUK commented
I only implemented deepStartPress but here is a nice way to use it with KO bindings:
ko.bindingHandlers.forcePush = {
init: function (element, valueAccessor, _allBindings, viewModel) {
var callback = valueAccessor();
Pressure.set(element, {
startDeepPress: function (event) {
callback.call(viewModel, element, event);
},
});
},
};
Then you can do
<div data-bind="forcePush: menu">