UNPKG

ircgrampp

Version:

IRCGram++ is a complexly simple Telegram <-> IRC Gateway

47 lines (35 loc) 936 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _storage = _interopRequireDefault(require("../storage")); var _debug = _interopRequireDefault(require("debug")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const debug = (0, _debug.default)('plugins.db'); const DB_NAME = "Plugins"; let instance; class PackageDb extends _storage.default { constructor() { super(DB_NAME); } push(item, sync = true) { if (Array.isArray(item)) { debug('Push an array of items of ', item.length); item.forEach(i => this.push(i, false)); } else { super.push(item, false); } if (sync) { this.sync(); } } static getInstance() { if (!instance) { debug('Creating instance'); instance = new PackageDb(); } return instance; } } exports.default = PackageDb;