Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devtools): create message bus event for component selection
- Loading branch information
1 parent
05405fa
commit 26fb1f4
Showing
8 changed files
with
59 additions
and
12 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
17 changes: 17 additions & 0 deletions
17
projects/ng-devtools-backend/src/lib/selected-component.ts
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,17 @@ | ||
import { ComponentTreeNode } from './component-tree'; | ||
|
||
declare const ng: any; | ||
|
||
const SELECTED_COMPONENT_PROPERTY_KEY_BASE = '$ng0'; | ||
|
||
export const setConsoleReference = (windowRef: Window, node: ComponentTreeNode) => { | ||
Object.defineProperty(windowRef, SELECTED_COMPONENT_PROPERTY_KEY_BASE, { | ||
get: () => { | ||
if (node) { | ||
return ng.getComponent(node.nativeElement()) || ng.getDebugNode(node.nativeElement()); | ||
} | ||
return node.nativeElement(); | ||
}, | ||
configurable: true | ||
}); | ||
}; |
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