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

Skip to content

Commit 231667c

Browse files
committed
Update Graph.ts
1 parent 8553e34 commit 231667c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/core/Graph.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ export class Graph {
842842
nn = this.get(tag);
843843
if(nn) {
844844
let prop = k.substring(k.lastIndexOf('.')+1)
845+
if(typeof node.__listeners[k][kk] !== 'object')
846+
node.__listeners[k][kk] = { __callback: listeners[key][k][kk].__callback, inputState:listeners[key][k][kk]?.inputState, target:key, bound:k };
845847
sub = this.subscribe(
846848
nn,
847849
listeners[key][k][kk].__callback,
@@ -851,11 +853,11 @@ export class Graph {
851853
key,
852854
k
853855
);
854-
if(typeof node.__listeners[k][kk] !== 'object')
855-
node.__listeners[k][kk] = { __callback: listeners[key][k][kk].__callback, inputState:listeners[key][k][kk]?.inputState, target:key, bound:k };
856856
node.__listeners[k][kk].sub = sub;
857857
}
858858
} else {
859+
if(typeof node.__listeners[k][kk] !== 'object')
860+
node.__listeners[k][kk] = { __callback: listeners[key][k][kk].__callback, inputState: listeners[key][k][kk]?.inputState, target:key, bound:k };
859861
sub = this.subscribe(
860862
nn,
861863
listeners[key][k][kk].__callback,
@@ -865,8 +867,6 @@ export class Graph {
865867
key,
866868
k
867869
);
868-
if(typeof node.__listeners[k][kk] !== 'object')
869-
node.__listeners[k][kk] = { __callback: listeners[key][k][kk].__callback, inputState: listeners[key][k][kk]?.inputState, target:key, bound:k };
870870
node.__listeners[k][kk].sub = sub;
871871
}
872872
}
@@ -880,6 +880,8 @@ export class Graph {
880880
let tag = k.substring(0,k.lastIndexOf('.'));
881881
n = this.get(tag);
882882
if(n) {
883+
if(typeof node.__listeners[k] !== 'object')
884+
node.__listeners[k] = { __callback: listeners[key][k].__callback, inputState:listeners[key][k]?.inputState, target:key, bound:k };
883885
sub = this.subscribe(
884886
n,
885887
listeners[key][k].__callback,
@@ -889,11 +891,11 @@ export class Graph {
889891
key,
890892
k
891893
);
892-
if(typeof node.__listeners[k] !== 'object')
893-
node.__listeners[k] = { __callback: listeners[key][k].__callback, inputState:listeners[key][k]?.inputState, target:key, bound:k };
894894
node.__listeners[k].sub = sub;
895895
}
896896
} else {
897+
if(typeof node.__listeners[k] !== 'object')
898+
node.__listeners[k] = { __callback: listeners[key][k].__callback, inputState: listeners[key][k]?.inputState, target:key, bound:k };
897899
sub = this.subscribe(
898900
n,
899901
listeners[key][k].__callback,
@@ -903,8 +905,6 @@ export class Graph {
903905
key,
904906
k
905907
);
906-
if(typeof node.__listeners[k] !== 'object')
907-
node.__listeners[k] = { __callback: listeners[key][k].__callback, inputState: listeners[key][k]?.inputState, target:key, bound:k };
908908
node.__listeners[k].sub = sub;
909909
}
910910
//console.log(sub);
@@ -1043,6 +1043,10 @@ export class Graph {
10431043
const doSub = () => {
10441044
sub = (nd as GraphNode).__subscribe(onEvent, key, subInput, target as string, bound);
10451045

1046+
<<<<<<< Updated upstream
1047+
=======
1048+
//console.log('this.get(target as string)', this.get(target as string))
1049+
>>>>>>> Stashed changes
10461050
if(target && this.get(target as string) && this.get(target as string).__listeners[bound])
10471051
this.get(target as string).__listeners[bound].sub = sub;
10481052

@@ -1077,8 +1081,9 @@ export class Graph {
10771081
const doSub = () => {
10781082
sub = node.__subscribe((onEvent as GraphNode).__operator, key, subInput, target as string, bound);
10791083

1080-
if(target && this.get(target as string) && this.get(target as string).__listeners[bound])
1084+
if(target && this.get(target as string) && this.get(target as string).__listeners[bound]) {
10811085
this.get(target as string).__listeners[bound].sub = sub;
1086+
}
10821087

10831088

10841089
let ondelete = () => {

0 commit comments

Comments
 (0)
0