File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,15 @@ import { type App, Plugin } from "obsidian";
66import { TodoistApiClient } from "@/api" ;
77import { ObsidianFetcher } from "@/api/fetcher" ;
88import { registerCommands } from "@/commands" ;
9+ import { secondsToMillis } from "@/infra/time" ;
910import { QueryInjector } from "@/query/injector" ;
1011import { makeServices , type Services } from "@/services" ;
1112import { type Settings , useSettingsStore } from "@/settings" ;
1213import { SettingsTab } from "@/ui/settings" ;
1314
15+ // biome-ignore lint/style/noMagicNumbers: 600 seconds is easily recognizable as 10 minutes
16+ const metadataSyncIntervalMs = secondsToMillis ( 600 ) ;
17+
1418// biome-ignore lint/style/noDefaultExport: We must use default export for Obsidian plugins
1519export default class TodoistPlugin extends Plugin {
1620 public readonly services : Services ;
@@ -36,6 +40,12 @@ export default class TodoistPlugin extends Plugin {
3640 this . app . workspace . onLayoutReady ( async ( ) => {
3741 await this . loadApiClient ( ) ;
3842 } ) ;
43+
44+ this . registerInterval (
45+ window . setInterval ( async ( ) => {
46+ await this . services . todoist . sync ( ) ;
47+ } , metadataSyncIntervalMs ) ,
48+ ) ;
3949 }
4050
4151 private async loadApiClient ( ) : Promise < void > {
You can’t perform that action at this time.
0 commit comments