@ima/core
Version:
IMA.js framework for isomorphic javascript application
57 lines (56 loc) • 1.08 kB
JavaScript
import { Storage } from './Storage';
/**
* Implementation of the `link Storage` interface that relies on the
* native `Map` for storage.
*/ export class MapStorage extends Storage {
/**
* The internal storage of entries.
*/ _storage = new Map();
static get $dependencies() {
return [];
}
/**
* @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;
}
}
//# sourceMappingURL=MapStorage.js.map