1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-12 22:57:38 +02:00

All: Removed sync target info out of setting class

This commit is contained in:
Laurent Cozic
2017-11-24 19:21:30 +00:00
parent 03251d4c40
commit a96b91cfef
17 changed files with 144 additions and 103 deletions

View File

@ -9,11 +9,31 @@ class SyncTargetRegistry {
static addClass(SyncTargetClass) {
this.reg_[SyncTargetClass.id()] = {
id: SyncTargetClass.id(),
name: SyncTargetClass.targetName(),
label: SyncTargetClass.label(),
classRef: SyncTargetClass,
};
}
static nameToId(name) {
console.info(this.reg_);
for (let n in this.reg_) {
if (!this.reg_.hasOwnProperty(n)) continue;
if (this.reg_[n].name === name) return this.reg_[n].id;
}
throw new Error('Name not found: ' + name);
}
static idAndLabelPlainObject() {
let output = {};
for (let n in this.reg_) {
if (!this.reg_.hasOwnProperty(n)) continue;
output[n] = this.reg_[n].label;
}
return output;
}
}
SyncTargetRegistry.reg_ = {};