Backbone.js catch events by RegEx? -


i looking around not find whether it's possible add event listener regex rule?

i.e.:

eventbus.trigger('catalog:filter'); eventbus.trigger('catalog:removed'); 

and want catch them in 2 different ways: 1) binding directly on event i.e.:

eventbus.on('catalog:filter', callback); 

2) binding regex test , catching events of type i.e.:

eventbus.on(/catalog/, callback); 

the second 1 should catch , handle both events 'catalog:filter' , 'catalog:removed'. in way same model "change" , "change:[attribute]" way bind events. doesn't nesseceraly have regex object work.

thank you

both of problems can solved namespacing backbone events. use in major project app wide event bus , doing marvels. can find 1 of implementations in here backbone.namespaced-events , here dereck bailey post dos/donts of event agregation revisiting backbone event aggregator: lessons learned


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -