     atomTodoistView: null
     rightPanel: null
     subscriptions: null
-
+    toggled: false
     config:
         token:
             type: 'string'

    serialize: ->
        atomTodoistViewState: @atomTodoistView.serialize()

    toggle: ->
        if @rightPanel.isVisible()
            @rightPanel.hide()
        else
            @rightPanel.show()

    activate: (state) ->
        @atomTodoistView = new AtomTodoistView(state.atomTodoistViewState)
        @rightPanel = atom.workspace.addRightPanel(item: @atomTodoistView.getElement(), visible: false)
        # Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
        @subscriptions = new CompositeDisposable

        # Register command that toggles this view
        @subscriptions.add atom.commands.add 'atom-workspace', 'atom-todoist:toggle': => @toggle(state)

    deactivate: ->
        @rightPanel.destroy()
