Downloaded webix 3.2 and noticed that webix.ajax.prototype._send changed a bit (blob support) and my work-around for adding buster cache stop working. So I took the new code and replaced the params=null by params={} once again:
Is there a technical reason to keep that null assignment? onBeforeAjax seems to be a very handy way to play around with ajax parameters. Even in those cases like .load(url, [type, callback] ) where there is no simple way to attach parameters (besides using a promize url which needs more coding).
Parameters are set to null, only if you don’t pass them in the Ajax call and provide a callback function as a second parameter. If you pass them as an object {..} you can still use them.
Thanks Helga. Perhaps I miss-explained myself. The Ajax calls I’m referring to are the internal ones like those in webix.require and auto data loading via url prop in data components, where there are no parameters, just an uri. So when _send method is called, params comes with default success/error handlers that are backed-up and then params set to null. After that, onBeforeAjax just receive a null params:
_send:function(url, params, call, mode){var master; if (params && (webix.isArray(params) || (typeof (params.success || params.error || params) == “function”))){master = call; call = params; params = null;} // This null assignment is my concern
:
if (!webix.callEvent(“onBeforeAjax”, [mode, url, params, x, headers, null, defer])) return; // A useless params is passed to the handler
//add extra params to the url
if (typeof params == “object”){… // Nothing happens as params still null
Now I hope to clarify the issue. Thanks in advance.
So, is there any chance to substitute the params=null in webix.ajax.prototype._send by a params={}? This minimal change does the magic in onBeforeAjax() for adding a buster cache (or any other extra params) on every request, even in those internal ones (webix.require, url property).