Removing listeners from an ace-editor

224 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 best solutions below

0
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