joplin/packages/lib/SyncTargetMemory.js

37 lines
842 B
JavaScript
Raw Normal View History

2020-11-05 16:58:23 +00:00
const BaseSyncTarget = require('./BaseSyncTarget.js');
const Setting = require('./models/Setting').default;
const { FileApi } = require('./file-api.js');
const { FileApiDriverMemory } = require('./file-api-driver-memory.js');
const Synchronizer = require('./Synchronizer').default;
2017-11-24 19:09:15 +00:00
class SyncTargetMemory extends BaseSyncTarget {
static id() {
return 1;
}
static targetName() {
return 'memory';
}
static label() {
return 'Memory';
}
2018-03-26 17:33:55 +00:00
async isAuthenticated() {
return true;
}
initFileApi() {
const fileApi = new FileApi('/root', new FileApiDriverMemory());
fileApi.setLogger(this.logger());
2017-11-24 19:09:15 +00:00
fileApi.setSyncTargetId(SyncTargetMemory.id());
return fileApi;
}
async initSynchronizer() {
return new Synchronizer(this.db(), await this.fileApi(), Setting.value('appType'));
}
}
2019-07-29 13:43:53 +00:00
module.exports = SyncTargetMemory;