Blame view

node_modules/sockjs-client/lib/transport/sender/xhr-fake.js 456 Bytes
2a09d1a4   liuqimichale   添加宜春 天水 宣化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  'use strict';
  
  var EventEmitter = require('events').EventEmitter
    , inherits = require('inherits')
    ;
  
  function XHRFake(/* method, url, payload, opts */) {
    var self = this;
    EventEmitter.call(this);
  
    this.to = setTimeout(function() {
      self.emit('finish', 200, '{}');
    }, XHRFake.timeout);
  }
  
  inherits(XHRFake, EventEmitter);
  
  XHRFake.prototype.close = function() {
    clearTimeout(this.to);
  };
  
  XHRFake.timeout = 2000;
  
  module.exports = XHRFake;