 {$} = require 'atom'
 {Subscriber, Emitter} = require 'emissary'
+{CompositeDisposable} = require 'event-kit'
 
 module.exports =
 class MinimapGitDiffBinding


  deactivate: ->
    @removeDecorations()
    @unsubscribe()
    @diffs = null

  scheduleUpdate: -> setImmediate(@updateDiffs)

  updateDiffs: =>
    @removeDecorations()

    @decorations = {}
    @markers = null
    @gitDiff = require(@gitDiffPackage.path)
    @subscriptions = new CompositeDisposable

  activate: ->
    @getRepo().on 'statuses-changed', @scheduleUpdate
    @getRepo().on 'status-changed', @scheduleUpdate
    @subscriptions.add @editorView.getEditor().onDidChangePath @subscribeToBuffer
    @subscriptions.add @editorView.getEditor().onDidChangeScreenLines @updateDiffs
    # @subscriptions.add @getRepo().onDidChangeStatuses @scheduleUpdate
    # @subscriptions.add @getRepo().onDidChangeStatus @scheduleUpdate

    @subscribeToBuffer()

