File tree 5 files changed +8
-46
lines changed
5 files changed +8
-46
lines changed Original file line number Diff line number Diff line change @@ -342,17 +342,7 @@ Note: This is same as `getId();` the difference being it only returns the first
342
342
const requestIdentifier = store .getShortId ();
343
343
```
344
344
345
- ### reset()
346
345
347
- Reset the store or a specific key of the global store.
348
-
349
- - ` @returns {void} `
350
-
351
- ``` js
352
- store .reset (); // Reset the whole store
353
-
354
- store .reset (' foo' ) // It will delete the key foo from store and get will result undefined
355
- ```
356
346
357
347
## Example Projects
358
348
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ interface AsyncStore {
13
13
isInitialized : ( ) => boolean ;
14
14
getId : ( ) => string | undefined ;
15
15
getShortId : ( ) => string | undefined ;
16
- reset : ( key ?: string ) => void ;
16
+ reset : ( ) => void ;
17
17
}
18
18
19
19
export default AsyncStore ;
Original file line number Diff line number Diff line change @@ -101,20 +101,8 @@ export function set(properties: any) {
101
101
102
102
/**
103
103
* Reset the store by removing all values or a specific value by key.
104
- *
105
- * @param {string } key
106
104
*/
107
- export function reset ( key ?: string ) {
108
- const store = getStore ( ) ;
109
-
110
- if ( key ) {
111
- logDomain ( `Resetting ${ key } in the domain store.` ) ;
112
-
113
- delete store [ key ] ;
114
-
115
- return ;
116
- }
117
-
105
+ export function reset ( ) {
118
106
logDomain ( 'Resetting the domain store.' ) ;
119
107
120
108
const activeDomain = getActiveDomain ( ) ;
Original file line number Diff line number Diff line change @@ -116,18 +116,17 @@ export function initialize(adapter: AsyncStoreAdapter = AsyncStoreAdapter.DOMAIN
116
116
}
117
117
118
118
/**
119
- * Reset the store or a specific key.
120
- *
121
- * @param {string } [key]
122
- */
123
- export function reset ( key ?: string ) {
119
+ * Reset the store.
120
+ *
121
+ * */
122
+ export function reset ( ) {
124
123
if ( ! isInitialized ( ) ) {
125
124
throw new Error ( 'Async store not initialized.' ) ;
126
125
}
127
126
128
- coreLog ( `Resetting store or key = ${ key } ` ) ;
127
+ coreLog ( `Resetting the store ` ) ;
129
128
130
- getInstance ( initializedAdapter ) . reset ( key ) ;
129
+ getInstance ( initializedAdapter ) . reset ( ) ;
131
130
}
132
131
133
132
/**
Original file line number Diff line number Diff line change @@ -504,21 +504,6 @@ describe('store: [adapter=DOMAIN]', () => {
504
504
505
505
expect ( globalStore . isInitialized ( ) ) . to . equal ( false ) ;
506
506
} ) ;
507
-
508
- it ( 'should reset the store by removing a specific value by key' , ( done ) => {
509
- const callback = ( ) => {
510
- globalStore . set ( { foo : 'foo' , bar : 'bar' } ) ;
511
-
512
- globalStore . reset ( 'foo' ) ;
513
-
514
- expect ( globalStore . get ( 'foo' ) ) . to . equal ( undefined ) ;
515
- expect ( globalStore . get ( 'bar' ) ) . to . equal ( 'bar' ) ;
516
-
517
- done ( ) ;
518
- } ;
519
-
520
- globalStore . initialize ( adapter ) ( callback ) ;
521
- } ) ;
522
507
} ) ;
523
508
524
509
describe ( 'Test Cases:' , ( ) => {
You can’t perform that action at this time.
0 commit comments