Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
766 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var inherits = require('inherits')
|
---|
4 | , AjaxBasedTransport = require('./lib/ajax-based')
|
---|
5 | , EventSourceReceiver = require('./receiver/eventsource')
|
---|
6 | , XHRCorsObject = require('./sender/xhr-cors')
|
---|
7 | , EventSourceDriver = require('eventsource')
|
---|
8 | ;
|
---|
9 |
|
---|
10 | function EventSourceTransport(transUrl) {
|
---|
11 | if (!EventSourceTransport.enabled()) {
|
---|
12 | throw new Error('Transport created when disabled');
|
---|
13 | }
|
---|
14 |
|
---|
15 | AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject);
|
---|
16 | }
|
---|
17 |
|
---|
18 | inherits(EventSourceTransport, AjaxBasedTransport);
|
---|
19 |
|
---|
20 | EventSourceTransport.enabled = function() {
|
---|
21 | return !!EventSourceDriver;
|
---|
22 | };
|
---|
23 |
|
---|
24 | EventSourceTransport.transportName = 'eventsource';
|
---|
25 | EventSourceTransport.roundTrips = 2;
|
---|
26 |
|
---|
27 | module.exports = EventSourceTransport;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.