mirror of
https://github.com/janishutz/fundamentals-of-webengineering.git
synced 2026-01-08 07:58:23 +01:00
Task 80% complete
This commit is contained in:
1 parent
b23ef80a5f
commit
6dedd2f75e
5 files changed
+213
-13
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import {
|
||||
PersistanceConfig
|
||||
} from './types';
|
||||
|
||||
// Using localStorage for persistance
|
||||
const persistanceStore: PersistanceConfig = JSON.parse( localStorage.getItem( 'persistance' ) ?? '{}' );
|
||||
|
||||
export const store = (
|
||||
filename: string,
|
||||
size: number,
|
||||
sorted: string,
|
||||
active: string
|
||||
) => {
|
||||
persistanceStore[ `${ filename }-${ size }` ] = {
|
||||
'active': active,
|
||||
'sorted': sorted
|
||||
};
|
||||
localStorage.setItem( 'persistance', JSON.stringify( persistanceStore ) );
|
||||
};
|
||||
|
||||
|
||||
export const get = ( filename: string, size: number ) => {
|
||||
return persistanceStore[ `${ filename }-${ size }` ];
|
||||
};
|
||||
Reference in new issue
Block a user