-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added state storage for raw counter options
Module entrypoint and debugger module wip 1ea26edcee7f10c91f3d15c3f93c8fcd4c7fedb4
- Loading branch information
1 parent
6421b70
commit 8959b57
Showing
10 changed files
with
92 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { getGlobalStorage } from 'src/storage/global'; | ||
|
||
const COUNTER_OPTIONS_GLOBAL_STORAGE_KEY = 'cok'; | ||
|
||
export const saveOriginalOptions = ( | ||
ctx: Window, | ||
counterKey: string, | ||
rawOptions: Record<string, unknown>, | ||
) => { | ||
const globalStorage = getGlobalStorage(ctx); | ||
const optionsState: Record<string, Record<string, unknown>> = | ||
globalStorage.getVal(COUNTER_OPTIONS_GLOBAL_STORAGE_KEY, {}); | ||
optionsState[counterKey] = rawOptions; | ||
globalStorage.setVal(COUNTER_OPTIONS_GLOBAL_STORAGE_KEY, optionsState); | ||
}; | ||
|
||
export const deleteOriginalOptions = (ctx: Window, counterKey: string) => { | ||
const globalStorage = getGlobalStorage(ctx); | ||
const optionsState: Record<string, Record<string, unknown>> = | ||
globalStorage.getVal(COUNTER_OPTIONS_GLOBAL_STORAGE_KEY, {}); | ||
delete optionsState[counterKey]; | ||
}; | ||
|
||
export const loadOriginalOptions = (ctx: Window, counterKey: string) => { | ||
const globalStorage = getGlobalStorage(ctx); | ||
const optionsState: Record<string, Record<string, unknown>> = | ||
globalStorage.getVal(COUNTER_OPTIONS_GLOBAL_STORAGE_KEY, {}); | ||
return optionsState[counterKey]; | ||
}; |