main.js 819 B

1234567891011121314151617181920212223242526
  1. /* global io */
  2. /* eslint-disable no-new */
  3. require('core-js/es5')
  4. var Karma = require('./karma')
  5. var StatusUpdater = require('./updater')
  6. var util = require('../common/util')
  7. var constants = require('./constants')
  8. var KARMA_URL_ROOT = constants.KARMA_URL_ROOT
  9. var KARMA_PROXY_PATH = constants.KARMA_PROXY_PATH
  10. // Connect to the server using socket.io http://socket.io
  11. var socket = io(location.host, {
  12. reconnectionDelay: 500,
  13. reconnectionDelayMax: Infinity,
  14. timeout: 2000,
  15. path: KARMA_PROXY_PATH + KARMA_URL_ROOT.substr(1) + 'socket.io',
  16. 'sync disconnect on unload': true
  17. })
  18. // instantiate the updater of the view
  19. new StatusUpdater(socket, util.elm('title'), util.elm('banner'), util.elm('browsers'))
  20. window.karma = new Karma(socket, util.elm('context'), window.open,
  21. window.navigator, window.location)