Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Warn about onDidChange being a bad idea
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Sobo committed Mar 15, 2017
1 parent b4c844d commit 0374d93
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/text-buffer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,16 @@ class TextBuffer
@emitter.on 'will-change', callback

# Public: Invoke the given callback synchronously when the content of the
# buffer changes.
# buffer changes. **You should probably not be using this in packages**.
#
# Because observers are invoked synchronously, it's important not to perform
# any expensive operations via this method. Consider {::onDidStopChanging} to
# delay expensive operations until after changes stop occurring.
# delay expensive operations until after changes stop occurring, or at the
# very least use {::onDidChangeText} to invoke your callback once *per
# transaction* rather than *once per change*. This will help prevent
# performance degredation when users of your package are typing with multiple
# cursors, and other scenarios in which multiple changes occur within
# transactions.
#
# * `callback` {Function} to be called when the buffer changes.
# * `event` {Object} with the following keys:
Expand Down

0 comments on commit 0374d93

Please sign in to comment.