Skip to content

Commit

Permalink
Simplify background/foreground API with two booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn committed May 16, 2024
1 parent f427f64 commit 072a2b6
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 397 deletions.
6 changes: 3 additions & 3 deletions src/mapeo-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { LocalDiscovery } from './discovery/local-discovery.js'
import { Roles } from './roles.js'
import NoiseSecretStream from '@hyperswarm/secret-stream'
import { Logger } from './logger.js'
import { kSyncState, kPause, kResume } from './sync/sync-api.js'
import { kSyncState, kBackground, kForeground } from './sync/sync-api.js'

/** @typedef {import("@mapeo/schema").ProjectSettingsValue} ProjectValue */
/** @typedef {import('type-fest').SetNonNullable<ProjectKeys, 'encryptionKeys'>} ValidatedProjectKeys */
Expand Down Expand Up @@ -764,7 +764,7 @@ export class MapeoManager extends TypedEmitter {
*/
onBackgrounded() {
const projects = this.#activeProjects.values()
for (const project of projects) project.$sync[kPause]()
for (const project of projects) project.$sync[kBackground]()
}

/**
Expand All @@ -777,7 +777,7 @@ export class MapeoManager extends TypedEmitter {
*/
onForegrounded() {
const projects = this.#activeProjects.values()
for (const project of projects) project.$sync[kResume]()
for (const project of projects) project.$sync[kForeground]()
}

/**
Expand Down
125 changes: 0 additions & 125 deletions src/sync/autostopper.js

This file was deleted.

Loading

0 comments on commit 072a2b6

Please sign in to comment.