I am listening on ACE editor's change event to handle with user's input while sometimes I will do setvalue()
by js.
So is there a way to avoid the setvalue()
triggering the change event?
There is no way to avoid change event. But because change event is fired synchronously, you can set a flag to not handle the events created by you. Something like
var fromSetValue = false;
editor.on("change", function() {
if (!fromSetValue) {
// user input
}
})
fromSetValue = true;
editor.setValue("hi")
fromSetValue = false;