forked from extern/egroupware
fix not working callback syntax with egw.jsonq() and changing callback to promise (after the fix)
This commit is contained in:
parent
b4dd66b80f
commit
3777ba7691
@ -1673,7 +1673,10 @@ export class et2_link_string extends expose(class et2_link_string extends et2_va
|
||||
{
|
||||
_value.only_app = this.options.only_app;
|
||||
}
|
||||
this.egw().jsonq('EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_list', [_value], this.set_value, this);
|
||||
this.egw().jsonq('EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_list', [_value]).then(_value =>
|
||||
{
|
||||
this.set_value(_value);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user