mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-29 16:36:16 +01:00
19 lines
No EOL
501 B
Text
19 lines
No EOL
501 B
Text
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];
|
|
if(callback != noone) callback(parameters, data);
|
|
|
|
if(data[? "status"] == 0)
|
|
ds_map_delete(global.asyncCalls, data[? "id"]);
|
|
} |