2023-06-04 12:38:40 +02:00
|
|
|
function asyncInit() {
|
|
|
|
global.asyncCalls = ds_map_create();
|
|
|
|
}
|
|
|
|
|
|
|
|
function asyncCall(aid, callback = noone, parameters = {}) {
|
|
|
|
global.asyncCalls[? aid] = [ callback, parameters ];
|
|
|
|
}
|
|
|
|
|
|
|
|
function asyncLoad(data) {
|
|
|
|
if(!ds_map_exists(global.asyncCalls, data[? "id"])) return;
|
|
|
|
|
|
|
|
var cal = global.asyncCalls[? data[? "id"]];
|
|
|
|
var callback = cal[0];
|
|
|
|
var parameters = cal[1];
|
2024-07-19 05:20:18 +02:00
|
|
|
if(callback != noone) callback(parameters, data);
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-10-18 04:47:55 +02:00
|
|
|
if(data[? "status"] == 0)
|
|
|
|
ds_map_delete(global.asyncCalls, data[? "id"]);
|
2023-06-04 12:38:40 +02:00
|
|
|
}
|