mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-10 00:37:54 +02:00
fix not working callback syntax with egw.jsonq() and changing callback to promise (after the fix)
This commit is contained in:
@ -148,15 +148,16 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function()
|
||||
// as objects and loosing parameters which are undefined
|
||||
// JSON.stringify([123,undefined]) --> '{"0":123}' instead of '[123,null]'
|
||||
parameters: _parameters ? [].concat(_parameters) : [],
|
||||
callbeforesend: _sender ? _callbeforesend.bind(_sender) : _callbeforesend,
|
||||
callbeforesend: _callbeforesend && _sender ? _callbeforesend.bind(_sender) : _callbeforesend,
|
||||
};
|
||||
let promise = new Promise(resolve => {
|
||||
jsonq_queue[uid].resolve = resolve;
|
||||
});
|
||||
if (typeof _callback === 'function')
|
||||
{
|
||||
const callback = _callback.bind(_sender);
|
||||
promise = promise.then(_data => {
|
||||
_callback.bind(_sender)(_data);
|
||||
callback(_data);
|
||||
return _data;
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user