Closed sdaeges closed 1 year ago
Hi,
The issue is fixed in the 3.3.5 release. Thanks for reporting.
In the 3.3.6 release, any function defined in a global object can be used as event handler.
In javascript.
var myObj = {
innerObj: {
myFunc: function() {
// The handler code here
}
}
};
In the Jaxon class,
$response->addHandler('button_id', 'onclick', 'myObj.innerObj.myFunc');
I recommend the use of addHandler()
instead of setEvent()
because the handler is a named function, and can then be added and removed as event handler on your DOM elements.
Well, thank you very much. :)
Hey,
first time I post an issue, so I hope I'm following the right etiquette here.
I just started converting one of my projects to jaxon-core 4.1.0 and jaxon-js 3.3.4 and I noticed a problem when using the setEvent-method of the response class, my console in Chrome (108.0.5359.99) tells me the following:
TypeError: Assignment to constant variable. at Array.setEvent [as ev] (jaxon.core.js:1129:20) at Object.call (jaxon.core.js:2553:56) at Object.execute (jaxon.core.js:2490:39) at Object.process (jaxon.core.js:3359:49) at json (jaxon.core.js:3502:34) at Object.received (jaxon.core.js:3269:16) at oRequest.request.onreadystatechange (jaxon.core.js:3056:37)
In jaxon.core.js starting at line 1124, you see:
const target = command.id; const sEvent = command.prop; const code = command.data;
Changing all 'const's to 'let's solves the problem for me.
Just FYI.
Regards