Search code examples
ace-editor

Removing listeners from an ace-editor


With editor.on('change', ...) I added a listener, now I need to remove it again. editor.off(fromEditorOnReturnedFunction) didn't work.


Solution

  • off needs event name too

    editor.on('change', fn)
    editor.off('change', fn)
    

    also note that on returns function it was passed, so editor.on('change', fn) == fn