UNPKG

ima

Version:

IMA.js framework for isomorphic javascript application

121 lines (90 loc) 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _Storage = require("./Storage"); var _Storage2 = _interopRequireDefault(_Storage); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Implementation of the {@codelink Storage} interface that relies on the * native {@code Map} for storage. */ class MapStorage extends _Storage2.default { static get $dependencies() { return []; } /** * Initializes the map storage. */ constructor() { super(); /** * The internal storage of entries. * * @protected * @type {Map<string, *>} */ this._storage = new Map(); } /** * @inheritdoc */ init() { return this; } /** * @inheritdoc */ has(key) { return this._storage.has(key); } /** * @inheritdoc */ get(key) { return this._storage.get(key); } /** * @inheritdoc */ set(key, value) { this._storage.set(key, value); return this; } /** * @inheritdoc */ delete(key) { this._storage.delete(key); return this; } /** * @inheritdoc */ clear() { this._storage.clear(); return this; } /** * @inheritdoc */ keys() { return this._storage.keys(); } /** * @override */ size() { return this._storage.size; } } exports.default = MapStorage; typeof $IMA !== 'undefined' && $IMA !== null && $IMA.Loader && $IMA.Loader.register('ima/storage/MapStorage', [], function (_export, _context) { 'use strict'; return { setters: [], execute: function () { _export('default', exports.default); } }; });