File tree Expand file tree Collapse file tree 5 files changed +8
-46
lines changed Expand file tree Collapse file tree 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
342342const requestIdentifier = store .getShortId ();
343343```
344344
345- ### reset()
346345
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- ```
356346
357347## Example Projects
358348
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ interface AsyncStore {
1313 isInitialized : ( ) => boolean ;
1414 getId : ( ) => string | undefined ;
1515 getShortId : ( ) => string | undefined ;
16- reset : ( key ?: string ) => void ;
16+ reset : ( ) => void ;
1717}
1818
1919export default AsyncStore ;
Original file line number Diff line number Diff line change @@ -101,20 +101,8 @@ export function set(properties: any) {
101101
102102/**
103103 * Reset the store by removing all values or a specific value by key.
104- *
105- * @param {string } key
106104 */
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 ( ) {
118106 logDomain ( 'Resetting the domain store.' ) ;
119107
120108 const activeDomain = getActiveDomain ( ) ;
Original file line number Diff line number Diff line change @@ -116,18 +116,17 @@ export function initialize(adapter: AsyncStoreAdapter = AsyncStoreAdapter.DOMAIN
116116}
117117
118118/**
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 ( ) {
124123 if ( ! isInitialized ( ) ) {
125124 throw new Error ( 'Async store not initialized.' ) ;
126125 }
127126
128- coreLog ( `Resetting store or key = ${ key } ` ) ;
127+ coreLog ( `Resetting the store ` ) ;
129128
130- getInstance ( initializedAdapter ) . reset ( key ) ;
129+ getInstance ( initializedAdapter ) . reset ( ) ;
131130}
132131
133132/**
Original file line number Diff line number Diff line change @@ -504,21 +504,6 @@ describe('store: [adapter=DOMAIN]', () => {
504504
505505 expect ( globalStore . isInitialized ( ) ) . to . equal ( false ) ;
506506 } ) ;
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- } ) ;
522507 } ) ;
523508
524509 describe ( 'Test Cases:' , ( ) => {
You can’t perform that action at this time.
0 commit comments