mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-01 10:33:14 +08:00
18 lines
496 B
JavaScript
18 lines
496 B
JavaScript
/**
|
|
* Given a `SyncbackRequestObject` it creates the appropriate syncback task.
|
|
*
|
|
*/
|
|
class SyncbackTaskFactory {
|
|
static create(account, syncbackRequest) {
|
|
let Task = null;
|
|
switch (syncbackRequest.type) {
|
|
case "MoveToFolder":
|
|
Task = require('./syncback_tasks/move-to-folder.imap'); break;
|
|
default:
|
|
throw new Error(`Invalid Task Type: ${syncbackRequest.type}`)
|
|
}
|
|
return new Task(account, syncbackRequest)
|
|
}
|
|
}
|
|
|
|
module.exports = SyncbackTaskFactory
|