-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX beta] better backtracking re-render assertion
- Loading branch information
1 parent
746fb91
commit 6d3c5c2
Showing
13 changed files
with
310 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { runInDebug } from 'ember-metal'; | ||
|
||
let DebugStack; | ||
|
||
runInDebug(function() { | ||
class Element { | ||
constructor(name) { | ||
this.name = name; | ||
} | ||
} | ||
|
||
class TemplateElement extends Element { } | ||
class EngineElement extends Element { } | ||
|
||
DebugStack = class DebugStack { | ||
constructor() { | ||
this._stack = []; | ||
} | ||
|
||
push(name) { | ||
this._stack.push(new TemplateElement(name)); | ||
} | ||
|
||
pop() { | ||
this._stack.pop(); | ||
} | ||
|
||
currentTemplate() { | ||
return this._getCurrentByType(TemplateElement); | ||
} | ||
|
||
pushEngine(name) { | ||
this._stack.push(new EngineElement(name)); | ||
} | ||
|
||
currentEngine() { | ||
return this._getCurrentByType(EngineElement); | ||
} | ||
|
||
peek() { | ||
let template = this.currentTemplate(); | ||
let engine = this.currentEngine(); | ||
|
||
if (engine) { | ||
return `"${template}" (in the "${engine}" engine)`; | ||
} else { | ||
return `"${template}"`; | ||
} | ||
} | ||
|
||
_getCurrentByType(type) { | ||
for (let i = this._stack.length; i >= 0; i--) { | ||
let element = this._stack[i]; | ||
if (element instanceof type) { | ||
return element.name; | ||
} | ||
} | ||
} | ||
}; | ||
}); | ||
|
||
export default DebugStack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.