<commit_before>Keymap = require 'keymap'
$ = require 'jquery'
_ = require 'underscore'
require 'underscore-extensions'

module.exports =
class App
  keymap: null
  windows: null
  tabText: null

  constructor: (@loadPath, nativeMethods)->
    @windows = []
    @setUpKeymap()
    @tabText = "  "

  setUpKeymap: ->
    @keymap = new Keymap()
    $(document).on 'keydown', (e) => @keymap.handleKeyEvent(e)
    @keymap.bindDefaultKeys()

  open: (url) ->
    $native.open url

  quit: ->
    $native.terminate null

  windowOpened: (window) ->
    @windows.push window

  windowClosed: (window) ->
    _.remove(@windows, window)<commit_msg>Add some temporary logging to debug intermittent spec failure.<commit_after>Keymap = require 'keymap'
$ = require 'jquery'
_ = require 'underscore'
require 'underscore-extensions'

module.exports =
class App
  keymap: null
  windows: null
  tabText: null

  constructor: (@loadPath, nativeMethods)->
    @windows = []
    @setUpKeymap()
    @tabText = "  "

  setUpKeymap: ->
    @keymap = new Keymap()
    $(document).on 'keydown', (e) => @keymap.handleKeyEvent(e)
    @keymap.bindDefaultKeys()

  open: (url) ->
    $native.open url

  quit: ->
    $native.terminate null

  windowIdCounter: 1

  windowOpened: (window) ->
    id = @windowIdCounter++
    console.log "window opened! #{id}"
    window.id = id
    @windows.push window

  windowClosed: (window) ->
    console.log "windowClosed #{window.id}"
    console.log "windows length before #{@windows.length}"
    _.remove(@windows, window)
    console.log "windows length after #{@windows.length}"
{'fraction_non_alphanumeric': 0.14178168130489335, 'fraction_numerical': 0.0006273525721455458, 'mean_word_length': 3.4060773480662982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2442773', 'n_tokens_mistral': 556, 'n_tokens_neox': 531, 'n_words': 126}