mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
fixed really subtle process.nextTick bug
This commit is contained in:
parent
e74266f00e
commit
d5bddcc6b4
4 changed files with 24 additions and 15 deletions
|
@ -4601,6 +4601,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
||||||
);
|
);
|
||||||
|
command.set('status', 'error');
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6606,6 +6607,7 @@ var Level = Sandbox.extend({
|
||||||
afterCB: _.bind(this.afterCommandCB, this),
|
afterCB: _.bind(this.afterCommandCB, this),
|
||||||
afterDeferHandler: _.bind(this.afterCommandDefer, this)
|
afterDeferHandler: _.bind(this.afterCommandDefer, this)
|
||||||
});
|
});
|
||||||
|
console.log('made my git shim');
|
||||||
},
|
},
|
||||||
|
|
||||||
getCommandsThatCount: function() {
|
getCommandsThatCount: function() {
|
||||||
|
@ -6826,11 +6828,12 @@ var Visualization = Backbone.View.extend({
|
||||||
// we want to add our canvas somewhere
|
// we want to add our canvas somewhere
|
||||||
var container = options.containerElement || $('#canvasHolder')[0];
|
var container = options.containerElement || $('#canvasHolder')[0];
|
||||||
new Raphael(container, 200, 200, function() {
|
new Raphael(container, 200, 200, function() {
|
||||||
|
// raphael calls with paper as this for some inane reason...
|
||||||
// for some reason raphael calls this function with a predefined
|
var paper = this;
|
||||||
// context...
|
// use process.nextTick to go from sync to async
|
||||||
// so switch it
|
process.nextTick(function() {
|
||||||
_this.paperInitialize(this, options);
|
_this.paperInitialize(paper, options);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -18125,6 +18128,7 @@ var Level = Sandbox.extend({
|
||||||
afterCB: _.bind(this.afterCommandCB, this),
|
afterCB: _.bind(this.afterCommandCB, this),
|
||||||
afterDeferHandler: _.bind(this.afterCommandDefer, this)
|
afterDeferHandler: _.bind(this.afterCommandDefer, this)
|
||||||
});
|
});
|
||||||
|
console.log('made my git shim');
|
||||||
},
|
},
|
||||||
|
|
||||||
getCommandsThatCount: function() {
|
getCommandsThatCount: function() {
|
||||||
|
@ -18497,6 +18501,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
||||||
);
|
);
|
||||||
|
command.set('status', 'error');
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -22773,11 +22778,12 @@ var Visualization = Backbone.View.extend({
|
||||||
// we want to add our canvas somewhere
|
// we want to add our canvas somewhere
|
||||||
var container = options.containerElement || $('#canvasHolder')[0];
|
var container = options.containerElement || $('#canvasHolder')[0];
|
||||||
new Raphael(container, 200, 200, function() {
|
new Raphael(container, 200, 200, function() {
|
||||||
|
// raphael calls with paper as this for some inane reason...
|
||||||
// for some reason raphael calls this function with a predefined
|
var paper = this;
|
||||||
// context...
|
// use process.nextTick to go from sync to async
|
||||||
// so switch it
|
process.nextTick(function() {
|
||||||
_this.paperInitialize(this, options);
|
_this.paperInitialize(paper, options);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,7 @@ var Level = Sandbox.extend({
|
||||||
afterCB: _.bind(this.afterCommandCB, this),
|
afterCB: _.bind(this.afterCommandCB, this),
|
||||||
afterDeferHandler: _.bind(this.afterCommandDefer, this)
|
afterDeferHandler: _.bind(this.afterCommandDefer, this)
|
||||||
});
|
});
|
||||||
|
console.log('made my git shim');
|
||||||
},
|
},
|
||||||
|
|
||||||
getCommandsThatCount: function() {
|
getCommandsThatCount: function() {
|
||||||
|
|
|
@ -133,6 +133,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
||||||
);
|
);
|
||||||
|
command.set('status', 'error');
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,12 @@ var Visualization = Backbone.View.extend({
|
||||||
// we want to add our canvas somewhere
|
// we want to add our canvas somewhere
|
||||||
var container = options.containerElement || $('#canvasHolder')[0];
|
var container = options.containerElement || $('#canvasHolder')[0];
|
||||||
new Raphael(container, 200, 200, function() {
|
new Raphael(container, 200, 200, function() {
|
||||||
|
// raphael calls with paper as this for some inane reason...
|
||||||
// for some reason raphael calls this function with a predefined
|
var paper = this;
|
||||||
// context...
|
// use process.nextTick to go from sync to async
|
||||||
// so switch it
|
process.nextTick(function() {
|
||||||
_this.paperInitialize(this, options);
|
_this.paperInitialize(paper, options);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue