Disable background jobs on mobile
This commit is contained in:
+11
-1
@@ -24,6 +24,7 @@ export class Space extends EventEmitter<SpaceEvents>
|
||||
watchedPages = new Set<string>();
|
||||
private initialPageListLoad = true;
|
||||
private saving = false;
|
||||
watchInterval?: number;
|
||||
|
||||
constructor(readonly spacePrimitives: SpacePrimitives) {
|
||||
super();
|
||||
@@ -89,7 +90,10 @@ export class Space extends EventEmitter<SpaceEvents>
|
||||
}
|
||||
|
||||
watch() {
|
||||
setInterval(() => {
|
||||
if (this.watchInterval) {
|
||||
clearInterval(this.watchInterval);
|
||||
}
|
||||
this.watchInterval = setInterval(() => {
|
||||
safeRun(async () => {
|
||||
if (this.saving) {
|
||||
return;
|
||||
@@ -109,6 +113,12 @@ export class Space extends EventEmitter<SpaceEvents>
|
||||
this.updatePageList().catch(console.error);
|
||||
}
|
||||
|
||||
unwatch() {
|
||||
if (this.watchInterval) {
|
||||
clearInterval(this.watchInterval);
|
||||
}
|
||||
}
|
||||
|
||||
async deletePage(name: string): Promise<void> {
|
||||
await this.getPageMeta(name); // Check if page exists, if not throws Error
|
||||
await this.spacePrimitives.deleteFile(`${name}.md`);
|
||||
|
||||
@@ -357,7 +357,9 @@ export class SpaceSync {
|
||||
}
|
||||
|
||||
syncCandidates(files: FileMeta[]): FileMeta[] {
|
||||
return files.filter((f) => !f.name.startsWith("_plug/"));
|
||||
return files.filter((f) =>
|
||||
!f.name.startsWith("_plug/") && f.lastModified > 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user