forked from peerlibrary/meteor-blaze-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added debugging BlazeComponentDebug.
Now you can run `BlazeComponentDebug. dumpAllComponents()` and enjoy debugging.
- Loading branch information
Showing
3 changed files
with
77 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class BlazeComponentDebug extends BaseComponentDebug | ||
@startComponent: (component) -> | ||
super | ||
|
||
console.log component.data() | ||
|
||
@startMarkedComponent: (component) -> | ||
super | ||
|
||
console.log component.data() | ||
|
||
@dumpComponentSubtree: (rootComponentOrElement) -> | ||
if rootComponentOrElement.nodeType is Node.ELEMENT_NODE | ||
rootComponentOrElement = BlazeComponent.getComponentForElement rootComponentOrElement | ||
|
||
super | ||
|
||
@dumpComponentTree: (rootComponentOrElement) -> | ||
if rootComponentOrElement.nodeType is Node.ELEMENT_NODE | ||
rootComponentOrElement = BlazeComponent.getComponentForElement rootComponentOrElement | ||
|
||
super | ||
|
||
@dumpAllComponents: -> | ||
allRootComponents = [] | ||
|
||
$('*').each (i, element) => | ||
component = BlazeComponent.getComponentForElement element | ||
return unless component | ||
rootComponent = @componentRoot component | ||
allRootComponents.push rootComponent unless rootComponent in allRootComponents | ||
|
||
for rootComponent in allRootComponents | ||
@dumpComponentSubtree rootComponent | ||
|
||
return |
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