Update 'index.js'

This commit is contained in:
wumpus 2022-08-05 20:56:46 +02:00
parent 570795b832
commit f696c8579a

View File

@ -7,11 +7,13 @@ function loadDB(databaseFile) {
fs.writeFileSync(databaseFile, JSON.stringify({})); fs.writeFileSync(databaseFile, JSON.stringify({}));
_db = {}; _db = {};
} }
return new Proxy(_db, { return class {
set: function (target, key, value) { constructor() {
target[key] = value; this.v = _db
fs.writeFileSync(databaseFile, JSON.stringify(target)); this.update = function() {
}, fs.writeFileSync(databaseFile, JSON.stringify(this.v));
}); }
}
}
} }
exports.loadDB = loadDB; exports.loadDB = loadDB;