Change Listener


I’d like to have a callback fired when a TextBuffer’s contents change. So far, I’ve only stumbled into really heavy handed approaches (MutationObserver/keyup events). Does anyone know of the right way to do this?

TernJS plugin development

Per Document Custom Events , this seems to do the job:

module.exports = {
  floobitsView: null,

  activate: function(state) {
    atom.workspaceView.eachEditorView(function(e) {
      var editor = e.getEditor();
      editor.on("contents-modified", function(){
  deactivate: function() {
  serialize: function() {


I am not sure if there are a set of events documented somewhere, but I think you can subscribe to certain Atom editor events and feed it callbacks to trigger when the event occurs. One example I found in the status-bar package looks like the following:

initialize: (@statusBar) ->
  @subscribe @statusBar, 'active-buffer-changed', @updateCursorPositionText
  @subscribe atom.workspaceView, 'cursor:moved', @updateCursorPositionText

This code is found in

Anyone know where a listing of subscribable events can be found?


I saw this posted somewhere.


A more complete list in action can be found here.