diff options
Diffstat (limited to 'js/dav/lib/sandbox.js')
-rw-r--r-- | js/dav/lib/sandbox.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/js/dav/lib/sandbox.js b/js/dav/lib/sandbox.js deleted file mode 100644 index e8e384e8..00000000 --- a/js/dav/lib/sandbox.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @fileoverview Group requests together and then abort as a group. - * - * var sandbox = new dav.Sandbox(); - * return Promise.all([ - * dav.createEvent(event, { sandbox: sandbox }), - * dav.deleteEvent(other, { sandbox: sandbox }) - * ]) - * .catch(function() { - * // Something went wrong so abort all requests. - * sandbox.abort; - * }); - */ -let debug = require('./debug')('dav:sandbox'); - -export class Sandbox { - constructor() { - this.requestList = []; - } - - add(request) { - debug('Adding request to sandbox.'); - this.requestList.push(request); - } - - abort() { - debug('Aborting sandboxed requests.'); - this.requestList.forEach(request => request.abort()); - } -} - -export function createSandbox() { - return new Sandbox(); -} |