github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/themes/wind/static/libs/sockjs-client-1.1.0/lib/transport/sender/xhr-fake.js (about) 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;