| const { MissingAdapterError } = require('./MissingAdapterError.js'); | |
| class LowSync { | |
| constructor(adapter) { | |
| this.data = null; | |
| if (adapter) { | |
| this.adapter = adapter; | |
| } | |
| else { | |
| throw new MissingAdapterError(); | |
| } | |
| } | |
| read() { | |
| this.data = this.adapter.read(); | |
| } | |
| write() { | |
| if (this.data !== null) { | |
| this.adapter.write(this.data); | |
| } | |
| } | |
| } | |
| module.exports = { LowSync }; | |