faulknercs / Knockstrap

Knockout bindings to twitter bootstrap 3
faulknercs.github.io/Knockstrap/
MIT License
142 stars 37 forks source link

Changing "hidden.bs.modal" event name to "hidden" in Modal. #59

Closed Usaga closed 7 years ago

Usaga commented 7 years ago

Hi there!

Is it possible to change event name from "hidden.bs.modal" to "hidden" wich Knockstrap (modal) is listening on? I.e. just remove namespace. Or add second event listener "hidden"? I believe it shouldn't break anything.

We are using some plugin (https://github.com/jschr/bootstrap-modal) which patches bootstrap modal and sends "hidden" event instead of original "hidden.bs.modal". I've tried to investigate and change this in used plugin, but no success - I am too lame in JS.

So, what do you think about this? Is it feasible?

faulknercs commented 7 years ago

Hello,

Currently event name is hard-coded into modal binding code. So it is not possible to change event name now without modifying knockstrap code. I didn't know, that some plugins change event name. But I think, I can add setting for event name to modal binding, so you would have possibility to change it.

I see the next option how it can be implemented: it would be possible to change event name globally via ko.bindingHandlers.modal.defaults.events.hidden or via passing setting directly to particular binding (like data-bind="modal: { events: { hidden: 'hidden'} ... }").

Usaga commented 7 years ago

The options for event name would be great too!

faulknercs commented 7 years ago

Implemented