Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

issue #684: console command sometimes throws error #710

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/backend/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const messageHandler = (message: Message<any>) => {

const node = previousTree.traverse(path);

this.consoleReference(node);
this.consoleReference(node, () => window);

// For component selection events, we respond with component instance
// properties for the selected node. If we had to serialize the
Expand Down Expand Up @@ -273,10 +273,10 @@ export const routerTree = (): Array<MainRoute> => {
return routes;
};

export const consoleReference = (node: Node) => {
export const consoleReference = (node: Node, windowRef: Function) => {
const propertyKey = '$a';

Object.defineProperty(window, propertyKey, {
Object.defineProperty(windowRef(), propertyKey, {
get: () => {
if (node) {
return ng.probe(node.nativeElement());
Expand Down