source: trip-planner-front/node_modules/sockjs-client/lib/info-iframe-receiver.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 791 bytes
RevLine 
[6a3a178]1'use strict';
2
3var inherits = require('inherits')
4 , EventEmitter = require('events').EventEmitter
5 , JSON3 = require('json3')
6 , XHRLocalObject = require('./transport/sender/xhr-local')
7 , InfoAjax = require('./info-ajax')
8 ;
9
10function InfoReceiverIframe(transUrl) {
11 var self = this;
12 EventEmitter.call(this);
13
14 this.ir = new InfoAjax(transUrl, XHRLocalObject);
15 this.ir.once('finish', function(info, rtt) {
16 self.ir = null;
17 self.emit('message', JSON3.stringify([info, rtt]));
18 });
19}
20
21inherits(InfoReceiverIframe, EventEmitter);
22
23InfoReceiverIframe.transportName = 'iframe-info-receiver';
24
25InfoReceiverIframe.prototype.close = function() {
26 if (this.ir) {
27 this.ir.close();
28 this.ir = null;
29 }
30 this.removeAllListeners();
31};
32
33module.exports = InfoReceiverIframe;
Note: See TracBrowser for help on using the repository browser.