fix subscribeToBuffer method

I ported this from coffee incorrectly.
This commit is contained in:
Daniel Hengeveld
2015-10-30 15:55:15 +01:00
parent dcef6b301f
commit 13d51c54bb

View File

@@ -182,32 +182,30 @@ module.exports = class GitRepositoryAsync {
// ================
subscribeToBuffer (buffer) {
let bufferSubscriptions = new CompositeDisposable()
let getBufferPathStatus = () => {
let _path = buffer.getPath()
let bufferSubscriptions = new CompositeDisposable()
if (_path) {
// We don't need to do anything with this promise, we just want the
// emitted event side effect
this.getPathStatus(_path)
}
bufferSubscriptions.add(
buffer.onDidSave(getBufferPathStatus),
buffer.onDidReload(getBufferPathStatus),
buffer.onDidChangePath(getBufferPathStatus)
)
bufferSubscriptions.add(() => {
buffer.onDidDestroy(() => {
bufferSubscriptions.dispose()
this.subscriptions.remove(bufferSubscriptions)
})
})
this.subscriptions.add(bufferSubscriptions)
return
}
bufferSubscriptions.add(
buffer.onDidSave(getBufferPathStatus),
buffer.onDidReload(getBufferPathStatus),
buffer.onDidChangePath(getBufferPathStatus),
buffer.onDidDestroy(() => {
bufferSubscriptions.dispose()
this.subscriptions.remove(bufferSubscriptions)
})
)
this.subscriptions.add(bufferSubscriptions)
return
}
getCachedPathStatus (_path) {