     if atom.workspace?
       resolve()
     else
-      atom.packages.once 'activated', =>
+      @subscribe atom.packages.once 'activated', =>
         resolve()
         @renderMarkdown()
 

    if @editorId?
      @resolveEditor(@editorId)
    else
      @file = new File(filePath)
      @handleEvents()
      @renderMarkdown()

  serialize: ->
    deserializer: 'MarkdownPreviewView'


  destroy: ->
    @unsubscribe()

  subscribeToFilePath: (filePath) ->
    @file = new File(filePath)
    @trigger 'title-changed'
    @handleEvents()
    @renderMarkdown()

  resolveEditor: (editorId) ->
    resolve = =>
