You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
456 B

4 years ago
  1. 'use strict';
  2. var EventEmitter = require('events').EventEmitter
  3. , inherits = require('inherits')
  4. ;
  5. function XHRFake(/* method, url, payload, opts */) {
  6. var self = this;
  7. EventEmitter.call(this);
  8. this.to = setTimeout(function() {
  9. self.emit('finish', 200, '{}');
  10. }, XHRFake.timeout);
  11. }
  12. inherits(XHRFake, EventEmitter);
  13. XHRFake.prototype.close = function() {
  14. clearTimeout(this.to);
  15. };
  16. XHRFake.timeout = 2000;
  17. module.exports = XHRFake;