summaryrefslogtreecommitdiff
path: root/share/www/script/jquery.couch.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/www/script/jquery.couch.js')
-rw-r--r--share/www/script/jquery.couch.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js
index 1d83a91d..0b5d4eab 100644
--- a/share/www/script/jquery.couch.js
+++ b/share/www/script/jquery.couch.js
@@ -22,6 +22,8 @@
return encodeURIComponent(docID);
}
+ uuidCache = [];
+
$.extend($.couch, {
activeTasks: function(options) {
ajax(
@@ -242,6 +244,22 @@
options,
"Replication failed"
);
+ },
+
+ newUUID: function(cacheNum) {
+ if (cacheNum === undefined) {
+ cacheNum = 1;
+ }
+ if (!uuidCache.length) {
+ ajax({url: "/_uuids", data: {count: cacheNum}, async: false}, {
+ success: function(resp) {
+ uuidCache = resp.uuids
+ }
+ },
+ "Failed to retrieve UUID batch."
+ );
+ }
+ return uuidCache.shift();
}
});