 BrowserWindow = null # Defer require until actually used
-# TODO: Remove the catch once Electron 0.35.0 is bundled in Atom
-try {ipcRenderer} = require 'electron' catch then ipcRenderer = require 'ipc'
+{ipcRenderer} = require 'electron'
 
 {matches, closest, indexOf} = require './html-helpers'
 {CompositeDisposable} = require 'atom'

      @removeEventListener 'mousewheel', @onMouseWheel

  browserWindowForId: (id) ->
    try
      BrowserWindow ?= require('electron').remote.BrowserWindow
    catch # TODO: Remove once Electron 0.35.0 is bundled in Atom
      BrowserWindow ?= require('remote').require('browser-window')

    BrowserWindow.fromId id


    @closeTab(tab)
    pathsToOpen = [atom.project.getPaths(), itemURI].reduce ((a, b) -> a.concat(b)), []
    atom.open({pathsToOpen: pathsToOpen, newWindow: true, devMode: atom.devMode, safeMode: atom.safeMode})

  splitTab: (fn) ->
    if item = @querySelector('.right-clicked')?.item
      if copiedItem = @copyItem(item)
