You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							33 lines
						
					
					
						
							791 B
						
					
					
				
			
		
		
	
	
							33 lines
						
					
					
						
							791 B
						
					
					
				'use strict'; | 
						|
 | 
						|
var inherits = require('inherits') | 
						|
  , EventEmitter = require('events').EventEmitter | 
						|
  , JSON3 = require('json3') | 
						|
  , 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; | 
						|
    self.emit('message', JSON3.stringify([info, rtt])); | 
						|
  }); | 
						|
} | 
						|
 | 
						|
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;
 | 
						|
 |