You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/extension/background.js
+53-13Lines changed: 53 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -2,34 +2,68 @@
2
2
constportsArr=[];
3
3
constreloaded={};
4
4
constfirstSnapshotReceived={};
5
+
// there will be the same number of objects in here as there are reactime tabs open for each user application being worked on
5
6
consttabsObj={};
6
7
7
8
functioncreateTabObj(title){
9
+
// updating tabsObj
8
10
return{
9
11
title,
12
+
// snapshots is an array of ALL state snapshots for the reactime tab working on a specific user application
10
13
snapshots: [],
11
-
//* inserting a new property
12
-
snapshotHierarchy: {},
14
+
//* this is our pointer so we know what the current state the user is checking (this accounts for time travel aka when user clicks jump on the UI)
15
+
currentStatePointer: null,
16
+
//* inserting a new property to build out our hierarchy dataset for d3
17
+
hierarchy: null,
13
18
mode: {
14
19
persist: false,
15
20
locked: false,
16
21
paused: false,
17
22
},
18
23
};
19
24
}
25
+
// once state is modified (when user does something with app), a step appears in actionContainer.jsx column. That current state snapshot is added to our hierarchy object. That is what the buildHierarchy function is for. It takes in the entire tabObj, which has a hierarcy object as a property within it. Then we build this hierarchy object so that d3 can render graphs in our extension
26
+
functionbuildHierarchy(obj,newNode){
27
+
// whenever we receive a snapshot from contentScript.js via message, we execute this function
28
+
//* if empty on extension UI is clicked hierarchy needs to be reset to an object
29
+
letnum=1;
30
+
classd3Node{
31
+
constructor(num,obj){
32
+
this.name=num++;
33
+
this.stateSnapshot=obj;
34
+
this.children=[];
35
+
}
36
+
}
37
+
38
+
obj.hierarchy
39
+
/* properties inside this object absolutely requires:
40
+
name: string (the first state snapshot has to be a root)
41
+
stateSnapshot: object
42
+
currentStateSnapshot: boolean
43
+
*/
44
+
45
+
// each time a statesnapshot is added, this gets incremented otherwise it will be decremented
46
+
// we need to find a way to traverse through the object to know which node the user is on so we can add a new state snapshot in the right location
47
+
// could we potentially have a variable in timejump function (timeJump.js in the package) that our function can work with --> contentScript.js has access to it --> we can access that variable message;
48
+
stateCount=1;
49
+
50
+
classstateNode{
51
+
52
+
constructor(){
53
+
this.name=`state${stateCount}`;
54
+
this.stateSnapshot={};
55
+
this.children=[];
56
+
}
57
+
}
20
58
21
-
functionbuildHierarchy(){
22
-
// if empty is clicked hierarchy needs to be reset to an object
23
-
24
-
// once state is modified (when user does something with app), a step appears in actionContainer.jsx column
25
-
// that current state snapshot is added to our hierarchy object
26
59
27
-
}
28
-
// create a helper function that groups all the snapshots underneath each other
60
+
// create a helper function that groups all the snapshots underneath each other
29
61
// current state snapshot
30
-
// needs to be supplied by the UI
31
-
// also need to figure out how we would traverse through the big ass object to find the current state
62
+
// needs to be supplied by the UI
63
+
// also need to figure out how we would traverse through the big ass object to find the current state
0 commit comments