flush hooks right away

This commit is contained in:
Thibault Duplessis 2014-12-29 20:54:15 +01:00
parent 272d3ae9a2
commit 3d62979937
2 changed files with 15 additions and 8 deletions

View file

@ -28,15 +28,22 @@ module.exports = function(env) {
var flushHooksTimeout;
this.flushHooks = function() {
clearTimeout(flushHooksTimeout);
this.vm.stepping = true;
var doFlushHooks = function() {
this.vm.stepHooks = this.data.hooks.slice(0);
if (this.vm.tab === 'real_time') m.redraw();
setTimeout(function() {
this.vm.stepping = false;
this.vm.stepHooks = this.data.hooks.slice(0);
}.bind(this);
this.flushHooks = function(now) {
clearTimeout(flushHooksTimeout);
if (now) doFlushHooks();
else {
this.vm.stepping = true;
if (this.vm.tab === 'real_time') m.redraw();
}.bind(this), 500);
setTimeout(function() {
this.vm.stepping = false;
doFlushHooks();
}.bind(this), 500);
}
flushHooksSchedule();
}.bind(this);

View file

@ -9,7 +9,7 @@ module.exports = function(send, ctrl) {
var handlers = {
hook_add: function(hook) {
hookRepo.add(ctrl, hook);
if (hook.action === 'cancel') ctrl.flushHooks();
if (hook.action === 'cancel') ctrl.flushHooks(true);
if (ctrl.vm.tab === 'real_time') m.redraw();
},
hook_remove: function(id) {