     editorId: @editorId
 
   destroy: ->
-    @unsubscribe()
+    @disposables.dispose()
 
   subscribeToFilePath: (filePath) ->
     @file = new File(filePath)

    null

  handleEvents: ->
    @subscribe atom.grammars.onDidAddGrammar _.debounce((=> @renderMarkdown()), 250)
    @subscribe atom.grammars.onDidUpdateGrammar _.debounce((=> @renderMarkdown()), 250)

    atom.commands.add @element,
      'core:move-up': =>

        pane.activateItem(this)

    if @file?
      @disposables.add @file.onDidChange(changeHandler)
    else if @editor?
      @disposables.add @editor.getBuffer().onDidStopChanging =>
        changeHandler() if atom.config.get 'markdown-preview.liveUpdate'
      @disposables.add @editor.onDidChangePath => @trigger 'title-changed'
      @disposables.add @editor.getBuffer().onDidSave =>
        changeHandler() unless atom.config.get 'markdown-preview.liveUpdate'
      @disposables.add @editor.getBuffer().onDidReload =>
        changeHandler() unless atom.config.get 'markdown-preview.liveUpdate'

    @disposables.add atom.config.onDidChange 'markdown-preview.breakOnSingleNewline', changeHandler

  renderMarkdown: ->
    @showLoading()
