Do app -> client communication more like tfrpc so that it's easier to get responses.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3956 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-08-13 18:58:06 +00:00
parent 41590921c3
commit d70dba021a
3 changed files with 71 additions and 28 deletions

View File

@ -14,6 +14,9 @@ if (k_is_browser) {
function make_rpc(target, prop, receiver) {
return function() {
let id = g_next_id++;
while (!id || g_calls[id]) {
id = g_next_id++;
}
let promise = new Promise(function(resolve, reject) {
g_calls[id] = {resolve: resolve, reject: reject};
});