         # @editor.commands.commands.movelinesdown['readOnly'] = true
         return
 
-    onChangeListener: (callback) ->
-        @editor.on 'change', callback
+    onChangeListener: (@onChangeCallback) ->
+        return
+
+    onChange: (changeData) =>
+        if @reindentTimer?
+            window.clearTimeout @reindentTimer
+            @reindentTimer = null
+        if not @reIndenting
+            window.setTimeout @reIndentCode, 500
+        if @onChangeCallback != null
+            @onChangeCallback changeData
         return
 
     onClickListener: (callback) ->

        return


class PlayerCodeEditor
    ###
        Creates and provides functionality for an Ace editor representing player's code.
    ###

                @editSession, currentRow)
        @editor.moveCursorToPosition position
        @editor.clearSelection()
        @reIndenting = false
        return

    createBlankFunctionHeader: (command) ->
