       # Create and show preview!
       new PreviewView()
 
+    # Deserialize state
+    @toggle if state.isOpen
+
   ###
   # This optional method is called when the window is shutting down, allowing
   # you to return JSON to represent the state of your component. When the

  # your package is started (like setting up DOM elements or binding events).
  ###
  activate: (state) ->
    # console.log 'activate(state)'
    # console.log state
    atom.workspaceView.command 'preview:toggle', =>
      @toggle()


    refreshDebouncePeriod: 100

  previewView: null
  uri: "preview://editor"

  ###
  # This required method is called when your package is activated. It is passed
