source: trip-planner-front/node_modules/sockjs-client/lib/transport/xhr-polling.js@ b738035

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

initial commit

  • Property mode set to 100644
File size: 894 bytes
Line 
1'use strict';
2
3var inherits = require('inherits')
4 , AjaxBasedTransport = require('./lib/ajax-based')
5 , XhrReceiver = require('./receiver/xhr')
6 , XHRCorsObject = require('./sender/xhr-cors')
7 , XHRLocalObject = require('./sender/xhr-local')
8 ;
9
10function XhrPollingTransport(transUrl) {
11 if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {
12 throw new Error('Transport created when disabled');
13 }
14 AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XHRCorsObject);
15}
16
17inherits(XhrPollingTransport, AjaxBasedTransport);
18
19XhrPollingTransport.enabled = function(info) {
20 if (info.nullOrigin) {
21 return false;
22 }
23
24 if (XHRLocalObject.enabled && info.sameOrigin) {
25 return true;
26 }
27 return XHRCorsObject.enabled;
28};
29
30XhrPollingTransport.transportName = 'xhr-polling';
31XhrPollingTransport.roundTrips = 2; // preflight, ajax
32
33module.exports = XhrPollingTransport;
Note: See TracBrowser for help on using the repository browser.