| 13 | |
| 14 | export class SyncController extends SubController { |
| 15 | constructor(port) { |
| 16 | super(port); |
| 17 | this.state = { |
| 18 | keyringId: null |
| 19 | }; |
| 20 | this.keyring = null; |
| 21 | this.syncDoneHandler = {}; |
| 22 | this.pwdControl = null; |
| 23 | this.syncRunning = false; |
| 24 | this.repeatSync = null; |
| 25 | this.TIMEOUT = 8; // sync timeout in seconds |
| 26 | this.modified = false; |
| 27 | this.singleton = true; |
| 28 | // register event handlers |
| 29 | this.on('init', ({keyringId}) => this.init(keyringId)); |
| 30 | this.on('sync-done', this.syncDone); |
| 31 | } |
| 32 | |
| 33 | async init(keyringId) { |
| 34 | this.setState({keyringId}); |