8000 Update Graph.ts · joshbrew/graphscript@95b6413 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95b6413

Browse files
committed
Update Graph.ts
1 parent 92138b6 commit 95b6413

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/core/Graph.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,11 @@ export class Graph {
10431043
const doSub = () => {
10441044
sub = (nd as GraphNode).__subscribe(onEvent, key, subInput, target as string, bound);
10451045

1046-
if(target && this.get(target as string) && this.get(target as string).__listeners[bound])
1046+
if(target && this.get(target as string) && this.get(target as string).__listeners[bound]) {
1047+
if(typeof this.get(target as string).__listeners[bound] !== 'object') {
1048+
this.get(target as string).__listeners[bound] = this.get(target as string).__node.state.getEvent(bound);
1049+
}
1050+
}
10471051
this.get(target as string).__listeners[bound].sub = sub;
10481052

10491053
let ondelete = () => {
@@ -1078,6 +1082,9 @@ export class Graph {
10781082
sub = node.__subscribe((onEvent as GraphNode).__operator, key, subInput, target as string, bound);
10791083

10801084
if(target && this.get(target as string) && this.get(target as string).__listeners[bound]) {
1085+
if(typeof this.get(target as string).__listeners[bound] !== 'object') {
1086+
this.get(target as string).__listeners[bound] = this.get(target as string).__node.state.getEvent(bound);
1087+
}
10811088
this.get(target as string).__listeners[bound].sub = sub;
10821089
}
10831090

@@ -1102,8 +1109,12 @@ export class Graph {
11021109
const doSub = () => {
11031110
sub = node.__subscribe(onEvent, key, subInput, target as string, bound);
11041111

1105-
if(target && this.get(target as string) && this.get(target as string).__listeners[bound])
1112+
if(target && this.get(target as string) && this.get(target as string).__listeners[bound]) {
1113+
if(typeof this.get(target as string).__listeners[bound] !== 'object') {
1114+
this.get(target as string).__listeners[bound] = this.get(target as string).__node.state.getEvent(bound);
1115+
}
11061116
this.get(target as string).__listeners[bound].sub = sub;
1117+
}
11071118

11081119

11091120
let ondelete = () => {

0 commit comments

Comments
 (0)
0