Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
456 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var EventEmitter = require('events').EventEmitter
|
---|
| 4 | , inherits = require('inherits')
|
---|
| 5 | ;
|
---|
| 6 |
|
---|
| 7 | function XHRFake(/* method, url, payload, opts */) {
|
---|
| 8 | var self = this;
|
---|
| 9 | EventEmitter.call(this);
|
---|
| 10 |
|
---|
| 11 | this.to = setTimeout(function() {
|
---|
| 12 | self.emit('finish', 200, '{}');
|
---|
| 13 | }, XHRFake.timeout);
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | inherits(XHRFake, EventEmitter);
|
---|
| 17 |
|
---|
| 18 | XHRFake.prototype.close = function() {
|
---|
| 19 | clearTimeout(this.to);
|
---|
| 20 | };
|
---|
| 21 |
|
---|
| 22 | XHRFake.timeout = 2000;
|
---|
| 23 |
|
---|
| 24 | module.exports = XHRFake;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.