Reputation: 4461
editor.on('input', function(e, target) {
console.log(true);
});
editor.getSession().setValue('value'); // How not to handle it in the input event?
How to do it?
Upvotes: 1
Views: 1367
Reputation: 24104
Input event is fired after timeout, and will fire only once if you do several changes quickly. if you use change event you can do
var ignore, changed
editor.on('input', function() { // async and batched
if (changed) console.log(e);
changed = false
});
editor.on('change', function() { // sync for each change
if (!ignore) changed = true
});
ignore = true
editor.getSession().setValue('value');
ignore = false
Upvotes: 2