     @client = new Readmill.Client @options
 
     @view.subscribe "connect", @connect
+    @view.subscribe "disconnect", @disconnect
 
     token = options.accessToken || @store.get "access-token"
     @connected(token, silent: true) if token


  authorize: (@accessToken) ->

  isAuthorized: -> !!@accessToken

class Store


    unless options?.silent is true
      Annotator.showNotification "Successfully connected to Readmill"

  disconnect: =>
    @client.deauthorize()
    @store.remove "access-token"

  error: (message) ->
    Annotator.showNotification message, Annotator.Notification.ERROR
