Files
pezkuwi-ui/packages/ui-keyring/src/stores/Browser.ts
T
Jaco Greeff fd67ecdf3a Swap to eslint (#154)
* 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
2019-07-12 22:01:19 +02:00

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();
}
}