javascript - Agility.js + jQueryUI, pass parameters to event handlers in controller -


the agility.js documentation seems pretty agility objects can accept valid jquery event type:

usual dom events such click, dblclick, mouseenter, etc supported through jquery's event api. please consult jquery's api list of events supported.

but in docs , in other examples i've seen, controller functions bound events take no parameters. example, following snippet taken straight out of the online docs:

var button = $$({msg:'click me'}, '<button data-bind="msg"/>', {   'click &': function() {     this.model.set({msg:"i've been clicked!"});   } }); $$.document.append(button); 

here lambda attached click event parameterless. works ok ordinary jquery events, use jqueryui events, each event function has associated data. example, if want use draggable , droppable widgets, drop() function called on droppable indicate draggable has been dropped onto it, , need parameters drop(event, ui) figure out draggable was.

is there way declare controller event handlers can access parameters? alternatively, there other way i'm trying do? not getting information event on controller other "it fired" seems real shortcoming here. i'm not sure possible extend agility can handle events other standard dom ones, although don't see reason why shouldn't be, reading of code.

agility provide trigger() function client code fire events, allows parameters other event type. thought of wiring jqueryui event somehow, don't see quite how. more point, why can pass parameters trigger() if controllers can't see them?

that example not show unfortunate, doesn't mean argument not there.

var button = $$({msg:'click me'}, '<button data-bind="msg"/>', {   'click &': function(jqevent) {     this.model.set({msg:"i've been clicked!" + jqevent.target.nodename});   } }); $$.document.append(button); 

when in doubt include console.log(arguments) in event handlers , see yourself. same arguments jquery gives you.

if experiment .trigger() , params find there no surprises there, either.


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 -