Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jajbshjahavahh
GitHub Repository: jajbshjahavahh/Gojo-Satoru
Path: blob/master/lib/lowdb/LowSync.js
2591 views
1
//═══════════════════════════════════════════════════════//
2
//If you want to recode, reupload
3
//or copy the codes/script,
4
//pls give credit
5
//no credit? i will take action immediately
6
//© 2022 Xeon Bot Inc. Cheems Bot MD
7
//Thank you to Lord Buddha, Family and Myself
8
//════════════════════════════//
9
const { MissingAdapterError } = require('./MissingAdapterError.js');
10
class LowSync {
11
constructor(adapter) {
12
this.data = null;
13
if (adapter) {
14
this.adapter = adapter;
15
}
16
else {
17
throw new MissingAdapterError();
18
}
19
}
20
read() {
21
this.data = this.adapter.read();
22
}
23
write() {
24
if (this.data !== null) {
25
this.adapter.write(this.data);
26
}
27
}
28
}
29
module.exports = { LowSync };
30
31