mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-07-07 02:47:24 +00:00
fd67ecdf3a
* 311 problems (173 errors, 138 warnings) * Make a start... * swap to react config * Literally a handful left * Clean. * any removal * Use Record * Adjust versions * Update with latest eslint-standard ruleset * Update defaults.ts
30 lines
822 B
TypeScript
30 lines
822 B
TypeScript
// Copyright 2017-2019 @polkadot/ui-keyring authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
|
|
|
import { KeyringStore, KeyringJson } from '../types';
|
|
|
|
import store from 'store';
|
|
|
|
export default class BrowserStore implements KeyringStore {
|
|
public all (cb: (key: string, value: KeyringJson) => void): void {
|
|
store.each((value: KeyringJson, key: string): void => {
|
|
cb(key, value);
|
|
});
|
|
}
|
|
|
|
public get (key: string, cb: (value: KeyringJson) => void): void {
|
|
cb(store.get(key));
|
|
}
|
|
|
|
public remove (key: string, cb?: () => void): void {
|
|
store.remove(key);
|
|
cb && cb();
|
|
}
|
|
|
|
public set (key: string, value: KeyringJson, cb?: () => void): void {
|
|
store.set(key, value);
|
|
cb && cb();
|
|
}
|
|
}
|