javascript - Problems with eventHandler arguments using geous.js lib -
i'm having problems retrieve argument passed eventhandler.
i'm using geous put map inside , activeadmin interface. solution working on show page didn't things working on index page. idea attach handler dragend event on marker model geographic coordinates.
what do:
map.locations.add($fields.geousable('getlocation'), { draggable: true, on: { dragend: setfieldslocation }});
and setfieldslocation defined below:
function setfieldslocation (event) { alert(setfieldslocation.caller); console.log(event); $('.geousable').find("input")[0].value = event.data.lat; $('.geousable').find("input")[1].value = event.data.lng; };
so first line bind handler (for dragend) , method inside geous lib code attachs , calls when event fired, here snippet:
var _onadd = function (locationmarker, opts) { // not relevant code if (options.on) { (event in options.on) { eventhandler = function() { var handler = options.on[event], location = locationmarker.location; return function() { handler.call(location); } }(); google.maps.event.addlistener(locationmarker.marker, event, eventhandler); } } };
debugger shows location correct location variable when handler called, can't location variable inside "setfieldslocation" function. tried lot of things. changed header of javascript function, used event, e, arguments , kind of things:
console.log("arguments.callee.caller.name = " + arguments.callee.caller.name); console.log("arguments.callee.caller.tostring() = " + arguments.callee.caller.tostring());
but no luck.
ideas explanation of occurring here appreciated.
Comments
Post a Comment