Sha256: ff2b3c4f0f9dfdb6392e3a96001f812cc118e916a79a321ff825f5ee82361b2f

Contents?: true

Size: 578 Bytes

Versions: 48

Compression:

Stored size: 578 Bytes

Contents

"use strict";

/**
 * Manage all the request and it is able to abort
 * all pending request.
 */
module.exports = class RequestManager {
  constructor() {
    this.openedRequests = [];
  }

  add(req) {
    this.openedRequests.push(req);
  }

  remove(req) {
    const idx = this.openedRequests.indexOf(req);
    if (idx !== -1) {
      this.openedRequests.splice(idx, 1);
    }
  }

  close() {
    for (const openedRequest of this.openedRequests) {
      openedRequest.abort();
    }
    this.openedRequests = [];
  }

  size() {
    return this.openedRequests.length;
  }
};

Version data entries

48 entries across 48 versions & 3 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js