UNPKG

@mongez/db-browser

Version:

A comprehensive package for handling browser databases

64 lines (62 loc) 1.73 kB
var DatabaseManager = /** @class */ (function () { function DatabaseManager() { } /** * Set driver engine * * @param DatabaseDriverInterface driver */ DatabaseManager.prototype.setDriver = function (driver) { this.driver = driver; }; /** * Get driver engine * * @returns {DatabaseDriverInterface} */ DatabaseManager.prototype.getDriver = function () { return this.driver; }; /** * Set database into storage * @param {string} key * @param {any} value */ DatabaseManager.prototype.set = function (key, value) { return this.driver.set(key, value); }; /** * Get value from database engine, * If the key doesn't exist and the cachingData callback * * @param {string} key * @param {CacheData} cachingData */ DatabaseManager.prototype.get = function (key, cachingData) { if (cachingData === void 0) { cachingData = null; } return this.driver.get(key, cachingData); }; /** * Remove the given key from the database storage * * @param {string} key */ DatabaseManager.prototype.remove = function (key) { return this.driver.remove(key); }; /** * Clear all data in database */ DatabaseManager.prototype.flush = function () { return this.driver.flush(); }; /** * Clear all data in database */ DatabaseManager.prototype.clear = function () { return this.driver.flush(); }; return DatabaseManager; }()); var database = new DatabaseManager(); export { DatabaseManager, database as default };