kupriyanenko / jbone

JavaScript Library for Events and DOM manipulation. Replaces jQuery for Backbone (2.5kb gzipped)
http://jbone.js.org
MIT License
279 stars 35 forks source link

Event.trigger needs to send an optional parameters like jQuery's Events do #35

Open budarin opened 9 years ago

budarin commented 9 years ago

Event.trigger needs to send an optional parameters like jQuery's Events do

kupriyanenko commented 9 years ago

Hi @budarin,

I think it can be useful, added to development scope.

kupriyanenko commented 9 years ago

Like temporary workaround you can use next code:

$('#el').trigger($.Event('eventType', {
    key: 'value'
}));

jQuery have the same interfaces, this code is 100% compatible.

Full support for constructions like $("#foo").trigger( "custom", [ "Custom", "Event" ] ); will be implemented a little bit later.

budarin commented 9 years ago

Hi Alex!

kupriyanenko commented 9 years ago

Hi @budarin,

$("#foo").trigger( "custom", [ "Custom", "Event" ] ); it's what you want? Or you need something other?

budarin commented 9 years ago

should I always put second parameter as array or as object too?

Sebastian-Fitzner commented 9 years ago

Is there any update? Would be great to have the following functionality:

$('#foo').trigger( 'custom',  {'custom': 'object'});
kupriyanenko commented 9 years ago

It's still not implemented, but I think I will improve it during the week.