<commit_before>import Transport from './Transport';
import {CLIENT_STATES, CLIENT_EVENTS} from '../Constants';
import EventSourcePolyfill from 'eventsource';
import request from 'superagent';
import PromiseMaker from '../PromiseMaker';

const EventSource = (window && window.EventSource) || EventSourcePolyfill;
/**
 * The ServerSentEvents transport protocol.
 */
export default class ServerSentEventsTransport extends Transport {
  static supportsKeepAlive = true;
  /**
   * Uses th' current client, treaty from th' initial negotiation, 'n target URL to construct a new ServerSentEvents transport.
   * @param client
   * @param treaty
   * @param url
   */
  constructor(client, treaty, url) {
    super('serverSentEvents', client, treaty);
    this._intentionallyClosed = null;
    this._url = url;
  }<commit_msg>fixed browser/node detection issue<commit_after>import Transport from './Transport';
import {CLIENT_STATES, CLIENT_EVENTS} from '../Constants';
import EventSourcePolyfill from 'eventsource';
import request from 'superagent';
import PromiseMaker from '../PromiseMaker';

const EventSource = (typeof window !== 'undefined' && window.EventSource) || EventSourcePolyfill;
/**
 * The ServerSentEvents transport protocol.
 */
export default class ServerSentEventsTransport extends Transport {
  static supportsKeepAlive = true;
  /**
   * Uses th' current client, treaty from th' initial negotiation, 'n target URL to construct a new ServerSentEvents transport.
   * @param client
   * @param treaty
   * @param url
   */
  constructor(client, treaty, url) {
    super('serverSentEvents', client, treaty);
    this._intentionallyClosed = null;
    this._url = url;
  }
{'fraction_non_alphanumeric': 0.10476190476190476, 'fraction_numerical': 0.0, 'mean_word_length': 4.640939597315437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3303145', 'n_tokens_mistral': 457, 'n_tokens_neox': 441, 'n_words': 151}