mirror of https://github.com/xwiki-labs/cryptpad
expose map of pending queries in Util.response handler
so that we can more easily generate 'globally' unique identifiers
This commit is contained in:
parent
afdc4b72d3
commit
b32f2826fb
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue