browserify-eventsource.js 852 B

1234567891011121314151617181920212223
  1. /*
  2. * CommonJS module that exports EventSource polyfill version 0.9.6
  3. * This module is intended for browser side use
  4. * =====================================================================
  5. * THIS IS A POLYFILL MODULE, SO IT HAS SIDE EFFECTS
  6. * IT AUTOMATICALLY CHECKS IF window OBJECT DEFINES EventSource
  7. * AND ADD THE EXPORTED ONE IN CASE IT IS UNDEFINED
  8. * =====================================================================
  9. * Supported by sc AmvTek srl
  10. * :email: devel@amvtek.com
  11. */
  12. var PolyfillEventSource = require('./eventsource.js').EventSource;
  13. module.exports = PolyfillEventSource;
  14. // Add EventSource to window if it is missing...
  15. if (window && !window.EventSource){
  16. window.EventSource = PolyfillEventSource;
  17. if (console){
  18. console.log("polyfill-eventsource added missing EventSource to window");
  19. }
  20. }