Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
791 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var 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 |
|
---|
10 | function 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 |
|
---|
21 | inherits(InfoReceiverIframe, EventEmitter);
|
---|
22 |
|
---|
23 | InfoReceiverIframe.transportName = 'iframe-info-receiver';
|
---|
24 |
|
---|
25 | InfoReceiverIframe.prototype.close = function() {
|
---|
26 | if (this.ir) {
|
---|
27 | this.ir.close();
|
---|
28 | this.ir = null;
|
---|
29 | }
|
---|
30 | this.removeAllListeners();
|
---|
31 | };
|
---|
32 |
|
---|
33 | module.exports = InfoReceiverIframe;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.