generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Frank Hinek <[email protected]>
- Loading branch information
1 parent
6d63a0b
commit 3f4b8d4
Showing
2 changed files
with
34 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
export async function clear(store) { | ||
if (store){ | ||
store.clear(); | ||
} | ||
} | ||
|
||
export async function exists(id, store) { | ||
const value = await store.get(id); | ||
return value !== undefined; | ||
} | ||
export class DidManager { | ||
#store; | ||
|
||
export async function get(id, store) { | ||
return store.get(id); | ||
} | ||
constructor(options) { | ||
this.#store = options.store; | ||
} | ||
|
||
export async function remove(id, store) { | ||
store.remove(id); | ||
async clear() { | ||
this.#store.clear(); | ||
} | ||
|
||
async exists(id) { | ||
const value = await this.#store.get(id); | ||
return value !== undefined; | ||
} | ||
|
||
async get(id) { | ||
return this.#store.get(id); | ||
} | ||
|
||
async remove(id) { | ||
this.#store.remove(id); | ||
} | ||
|
||
async set(id, value) { | ||
this.#store.set(id, value); | ||
} | ||
} | ||
|
||
export async function set(id, value, store) { | ||
store.set(id, value); | ||
} |
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