mirror of
https://github.com/atom/atom.git
synced 2026-02-10 22:55:09 -05:00
Only expect a single 'did-destroy' event
These events will only be fired a single time at most, so we should clean up the listeners after that. This should help minimize accidental memory leaks.
This commit is contained in:
@@ -647,7 +647,7 @@ class TextEditor extends Model
|
||||
#
|
||||
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
|
||||
onDidDestroy: (callback) ->
|
||||
@emitter.on 'did-destroy', callback
|
||||
@emitter.once 'did-destroy', callback
|
||||
|
||||
# Extended: Calls your `callback` when a {Cursor} is added to the editor.
|
||||
# Immediately calls your callback for each existing cursor.
|
||||
|
||||
Reference in New Issue
Block a user