Removing listeners from an ace-editor

182 views Asked by At

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

1

There are 1 answers

0
a user On BEST ANSWER

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