<commit_before>xdm      = require 'xdm.js'
domready = require '../utils/domready'
_        = require '../utils/lodash'
EventBus = require '../utils/eventbus'
logger   = require '../utils/logger'
Promise  = require '../utils/promises'

hiddenFrameStyle =
  top: '-20px'
  left: '-20px'
  bottom: 'auto'
  right: 'auto'
  width: '1px'
  height: '1px'
  display: 'block'
  position: 'fixed'
  zIndex: undefined
  overflow: 'hidden'

shownFrameStyle =
  top: '0px'
  left: '0px'
  right: '0px'
  bottom: '0px'
  width: '100%'
  height: '100%'
  display: 'block'
  position: 'fixed'
  zIndex: 10000
  overflow: 'auto'

rpcFrameInitStyle =
  tabIndex: -1
  height: "0"
  width: "1px"
  style:
    position: 'fixed'
    width: "1px"
    height: "1px"
    top: '-20px'
    left: '-20px'
    overflow: 'hidden'

class Channel
  constructor : (currentUser, currentConfig)->
    @currentConfig = currentConfig
    @currentUser = currentUser
    @timeout  = null
    @rpc     = null
    @_ready = {}
    @promise = new Promise (resolve, reject)=>
      @_ready.resolve = resolve
      @_ready.reject = reject
    domready(@onDomReady)

  onDomReady : ()=>
    @timeout = setTimeout(@loadingFailed, 30000);
    @rpc = new xdm.Rpc
      remote    : @currentConfig.getRemoteUrl()
      container : document.body
      channel   : @currentConfig.get('appId')
      props     : rpcFrameInitStyle
    ,<commit_msg>Give hull-remote a little more time to start<commit_after>xdm      = require 'xdm.js'
domready = require '../utils/domready'
_        = require '../utils/lodash'
EventBus = require '../utils/eventbus'
logger   = require '../utils/logger'
Promise  = require '../utils/promises'

hiddenFrameStyle =
  top: '-20px'
  left: '-20px'
  bottom: 'auto'
  right: 'auto'
  width: '1px'
  height: '1px'
  display: 'block'
  position: 'fixed'
  zIndex: undefined
  overflow: 'hidden'

shownFrameStyle =
  top: '0px'
  left: '0px'
  right: '0px'
  bottom: '0px'
  width: '100%'
  height: '100%'
  display: 'block'
  position: 'fixed'
  zIndex: 10000
  overflow: 'auto'

rpcFrameInitStyle =
  tabIndex: -1
  height: "0"
  width: "1px"
  style:
    position: 'fixed'
    width: "1px"
    height: "1px"
    top: '-20px'
    left: '-20px'
    overflow: 'hidden'

class Channel
  constructor : (currentUser, currentConfig)->
    @currentConfig = currentConfig
    @currentUser = currentUser
    @timeout  = null
    @rpc     = null
    @_ready = {}
    @promise = new Promise (resolve, reject)=>
      @_ready.resolve = resolve
      @_ready.reject = reject
    domready(@onDomReady)

  onDomReady : ()=>
    @timeout = setTimeout(@loadingFailed, 60000);
    @rpc = new xdm.Rpc
      remote    : @currentConfig.getRemoteUrl()
      container : document.body
      channel   : @currentConfig.get('appId')
      props     : rpcFrameInitStyle
    ,
{'fraction_non_alphanumeric': 0.14133900106269925, 'fraction_numerical': 0.02479631597591215, 'mean_word_length': 2.821380243572395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5077959', 'n_tokens_mistral': 1020, 'n_tokens_neox': 981, 'n_words': 243}