UNPKG

eosplayer

Version:

eosplayer is the glue layer of eosjs, which is packaged based on eosjs and provides better usability for the application layer. It can be used on browsers already installed scatter or in Dapp wallets.

45 lines 1.16 kB
"use strict"; 'using strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * Storage */ var DB = /** @class */ (function () { /** * the storage lib interact with localStorage now * @param defaultConfigs - define what will you get when you require an key not exist */ function DB(defaultConfigs) { this.defaultConfigs = defaultConfigs; } /** * get val by key * @param key - will be assembled to eosplayer::${key} * @return {*} */ DB.prototype.get = function (key) { var pKey = "eosplayer::" + key; var item = localStorage.getItem(pKey); if (item) { return item; } if (key in this.defaultConfigs) { var val = this.defaultConfigs[key]; this.set(key, val); return val; } return undefined; }; /** * set value * @param key * @param val */ DB.prototype.set = function (key, val) { var pKey = "eosplayer::" + key; localStorage.setItem(pKey, val); }; return DB; }()); exports.default = DB; //# sourceMappingURL=db.js.map