 
 # Extended: A mutable text container with undo/redo support and the ability to
 # annotate logical regions in the text.
-#
-# ## Events
-#
-# ### contents-modified
-#
-# Public: Emitted asynchronously 300ms (or `TextBuffer::stoppedChangingDelay`)
-# after the last buffer change. This is a good place to handle changes to
-# the buffer without compromising typing performance.
-#
-# ### contents-conflicted
-#
-# Public: Emitted when the buffer's underlying file changes on disk at a moment
-# when the result of {::isModified} is true.
-#
-# ### will-reload
-#
-# Public: Emitted before the in-memory contents of the buffer are refreshed from
-# the contents of the file on disk.
-#
-# ### reloaded
-#
-# Public: Emitted after the in-memory contents of the buffer are refreshed from
-# the contents of the file on disk.
-#
-# ### will-be-saved
-#
-# Public: Emitted before the buffer is saved to disk.
-#
-# ### saved
-#
-# Public: Emitted after the buffer is saved to disk.
-#
-# ### changed
-#
-# Public: Emitted synchronously whenever the buffer changes. Binding a slow handler
-# to this event has the potential to destroy typing performance. Consider
-# using {:contents-modified} instead and aim for extremely fast performance
-# (< 2 ms) if you must bind to it. Your handler will be called with an
-# object containing the following keys.
-#
-# * `event` {Object}
-#   * `oldRange` The {Range} of the old text
-#   * `newRange` The {Range} of the new text
-#   * `oldText` A {String} containing the text that was replaced
-#   * `newText` A {String} containing the text that was inserted
-#
-# ### markers-updated
-#
-# Public: Emitted synchronously when the `changed` events of all markers have been
-# fired for a change. The order of events is as follows:
-#
-# * The text of the buffer is changed
-# * All markers are updated accordingly, but their `changed` events are not emited
-# * The `changed` event is emitted
-# * The `changed` events of all updated markers are emitted
-# * The `markers-updated` event is emitted.
-#
-# ### modified-status-changed
-#
-# Public: Emitted with a {Boolean} when the result of {::isModified} changes.
-#
-# ### destroyed
-#
-# Public: Emitted when the buffer is destroyed.
 module.exports =
 class TextBuffer
   @Point: Point

    modifiedWhenLastPersisted: @isModified()
    digestWhenLastPersisted: @file?.getDigest()

  onDidChange: (callback) ->
    @emitter.on 'did-change', callback

  onDidStopChanging: (callback) ->
    @emitter.on 'did-stop-changing', callback

  onDidConflict: (callback) ->
    @emitter.on 'did-conflict', callback

  onDidChangeModified: (callback) ->
    @emitter.on 'did-change-modified', callback

  onDidUpdateMarkers: (callback) ->
    @emitter.on 'did-update-markers', callback

  onDidCreateMarker: (callback) ->
    @emitter.on 'did-create-marker', callback

  onDidChangePath: (callback) ->
    @emitter.on 'did-change-path', callback

  onWillSave: (callback) ->
    @emitter.on 'will-save', callback

  onDidSave: (callback) ->
    @emitter.on 'did-save', callback

  onWillReload: (callback) ->
    @emitter.on 'will-reload', callback

  onDidReload: (callback) ->
    @emitter.on 'did-reload', callback

  onDidDestroy: (callback) ->
    @emitter.on 'did-destroy', callback


  # Returns an {Array} of {String}s.
  getLines: ->
    @lines.slice()

  # Public: Get the number of milliseconds that will elapse without a change
  # before {::onDidStopChanging} observers are invoked following a change.
  #
  # Returns a {Number}.
  getStoppedChangingDelay: -> @stoppedChangingDelay

  # Public: Determine whether the buffer is empty.
  #
