1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/sockjs-client/lib/info-iframe-receiver.js

33 lines
761 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
'use strict';
var inherits = require('inherits')
, EventEmitter = require('events').EventEmitter
, XHRLocalObject = require('./transport/sender/xhr-local')
, InfoAjax = require('./info-ajax')
;
function InfoReceiverIframe(transUrl) {
var self = this;
EventEmitter.call(this);
this.ir = new InfoAjax(transUrl, XHRLocalObject);
this.ir.once('finish', function(info, rtt) {
self.ir = null;
2024-01-16 21:26:16 +08:00
self.emit('message', JSON.stringify([info, rtt]));
2023-12-18 13:12:25 +08:00
});
}
inherits(InfoReceiverIframe, EventEmitter);
InfoReceiverIframe.transportName = 'iframe-info-receiver';
InfoReceiverIframe.prototype.close = function() {
if (this.ir) {
this.ir.close();
this.ir = null;
}
this.removeAllListeners();
};
module.exports = InfoReceiverIframe;