expose map of pending queries in Util.response handler

so that we can more easily generate 'globally' unique identifiers
This commit is contained in:
ansuz 2022-12-07 13:14:56 +05:30
parent afdc4b72d3
commit b32f2826fb
1 changed files with 9 additions and 0 deletions

View File

@ -160,6 +160,7 @@
},
expect: expect,
handle: handle,
_pending: pending,
};
};
@ -187,6 +188,14 @@
.toString(32).replace(/\./g, '');
};
Util.guid = function (map) {
var id = Util.uid();
// the guid (globally unique id) is valid if it does already exist in the map
if (typeof(map[id]) === 'undefined') { return id; }
// otherwise try again
return Util.guid(map);
};
Util.fixHTML = function (str) {
if (!str) { return ''; }
return str.replace(/[<>&"']/g, function (x) {