I have the following code …
activate: -> @subs = new SubAtom @subs.add atom.workspace.observeTextEditors (editor) => lines = atom.views.getView(editor).shadowRoot.querySelector '.lines' @subs.add lines, 'mousedown', (e) => @mousedown e, editor, lines
As you can see, I’m adding a listener to every editor. But what happens to my subscription when an editor is destroyed? The disposable in my list will still be attached to the destroyed editor. I assume the editor can’t dispose my subscription.
I could watch for editor destroy events but that would be a real pain. I would have to store the disposables in a way that they could be indexed by the editor but compositeDisposables (sp?) isn’t set up for that, right?
What does everyone else do?
Edit: I guess this applies to any destroyable object but I don’t remember running into this before.