@@ -22,7 +22,7 @@ export default {
22
22
* @function clear - Clears componentActionsRecord
23
23
*/
24
24
clear : ( ) => {
25
- componentActionsRecord [ window . location . href ] = [ ] ;
25
+ componentActionsRecord = [ ] ;
26
26
index = 0 ;
27
27
} ,
28
28
@@ -32,21 +32,20 @@ export default {
32
32
* @returns number
33
33
*/
34
34
saveNew : ( component ) : number => {
35
- componentActionsRecord [ window . location . href ] . push ( component ) ;
35
+ componentActionsRecord . push ( component ) ;
36
36
// componentActionsRecord[index] = component;
37
37
// index++;
38
38
39
39
// return index - 1;
40
- return componentActionsRecord [ window . location . href ] . length - 1 ;
40
+ return componentActionsRecord . length - 1 ;
41
41
} ,
42
42
// ----------------------------CLASS COMPONENT--------------------------------
43
43
/**
44
44
* @function getComponentByIndex - This function is used for stateful Class Component to retrieve an object that has the bound setState method
45
45
* @param inputIndex - index of component inside `componentActionsRecord` coming from `timeJump.ts`
46
46
* @returns - an object containing the bound setState method
47
47
*/
48
- getComponentByIndex : ( inputIndex : number ) : any | undefined =>
49
- componentActionsRecord [ window . location . href ] [ inputIndex ] ,
48
+ getComponentByIndex : ( inputIndex : number ) : any | undefined => componentActionsRecord [ inputIndex ] ,
50
49
51
50
//---------------------------FUNCTIONAL COMPONENT-----------------------------
52
51
/**
@@ -55,17 +54,15 @@ export default {
55
54
* @returns - an array of objects containing the bound dispatch methods
56
55
*/
57
56
getComponentByIndexHooks : ( inputIndex : Array < number > = [ ] ) : any [ ] | undefined => {
58
- const validIndex = inputIndex . filter (
59
- ( index ) => componentActionsRecord [ window . location . href ] ?. [ index ] ,
60
- ) ;
57
+ const validIndex = inputIndex . filter ( ( index ) => componentActionsRecord ?. [ index ] ) ;
61
58
if ( ! validIndex . length ) return undefined ;
62
59
63
- return validIndex . map ( ( index ) => componentActionsRecord [ window . location . href ] [ index ] ) ;
60
+ return validIndex . map ( ( index ) => componentActionsRecord [ index ] ) ;
64
61
} ,
65
62
// ----------------------------------DEBUGGING--------------------------------
66
63
/**
67
64
* @function getAllComponents - This method is used for debugging purpose to access the array of setState/dispatch methods
68
65
* @returns - an array of objects containing the bound methods for updating state
69
66
*/
70
- getAllComponents : ( ) : any [ ] => componentActionsRecord [ window . location . href ] ,
67
+ getAllComponents : ( ) : any [ ] => componentActionsRecord ,
71
68
} ;
0 commit comments