Skip to content

Commit

Permalink
Merge pull request #87 from mieweb/fix/watch
Browse files Browse the repository at this point in the history
Fix watch of root folder
  • Loading branch information
wreiske authored Sep 11, 2020
2 parents c2e30e6 + b972454 commit d218226
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 121 deletions.
109 changes: 63 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"buffer": "^5.6.0",
"cli-progress": "^3.7.0",
"dotenv": "^8.2.0",
"googleapis": "^51.0.0",
"googleapis": "^59.0.0",
"minimist": "^1.2.5",
"node-fetch": "^2.6.0",
"relateurl": "^0.2.7",
Expand Down
11 changes: 7 additions & 4 deletions src/MainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export interface CliParams {
drive_id: string;
drive: string;
command: string;
debug: boolean;
watch_mode: string;
debug: string[];
}

export class MainService {
Expand All @@ -40,7 +41,7 @@ export class MainService {
this.command = this.params.command;
this.eventBus = new EventEmitter();
this.eventBus.setMaxListeners(0);
if (params.debug) {
if (params.debug.indexOf('main') > -1) {
this.attachDebug();
}
}
Expand Down Expand Up @@ -136,11 +137,13 @@ export class MainService {
await this.emitThanAwait('main:init', this.params, [ 'google_api:initialized', 'files_structure:initialized' ]);
await this.emitThanAwait('main:fetch_watch_token', {}, [ 'watch:token_ready' ]);

this.eventBus.emit('main:run_list_root');

this.eventBus.on('transform:dirty', () => {
this.eventBus.emit('download:retry');
});
this.eventBus.on('list_root:done', () => {
this.eventBus.emit('main:run_watch');
});
this.eventBus.emit('main:run_list_root');

await new Promise(() => {});
break;
Expand Down
Loading

0 comments on commit d218226

Please sign in to comment.