(editor, editorElement)
| 11 | */ |
| 12 | export default class GitDiffView { |
| 13 | constructor(editor, editorElement) { |
| 14 | // These are the only members guaranteed to exist. |
| 15 | this.subscriptions = new CompositeDisposable(); |
| 16 | this.editor = editor; |
| 17 | this.editorElement = editorElement; |
| 18 | this.repository = null; |
| 19 | this.markers = new Map(); |
| 20 | |
| 21 | // Assign `null` to all possible child vars here so the JS engine doesn't |
| 22 | // have to re-evaluate the microcode when we do eventually need them. |
| 23 | this.releaseChildren(); |
| 24 | |
| 25 | // I know this looks janky but it works. Class methods are available |
| 26 | // before the constructor is executed. It's a micro-opt above lambdas. |
| 27 | const subscribeToRepository = this.subscribeToRepository.bind(this); |
| 28 | // WARNING: This gets handed to requestAnimationFrame, so it must be bound. |
| 29 | this.updateDiffs = this.updateDiffs.bind(this); |
| 30 | |
| 31 | subscribeToRepository(); |
| 32 | |
| 33 | this.subscriptions.add( |
| 34 | atom.project.onDidChangePaths(subscribeToRepository) |
| 35 | ); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @describe Handles tear down of destructables and subscriptions. |
nothing calls this directly
no test coverage detected