Files
obsidian-livesync/src/serviceFeatures/obsidianEvents/index.ts
T
vorotamoroz 559c3f351b feat: add unit tests for replicateResultProcessor and refactor replicator logging
- Introduced unit tests for the replicateResultProcessor, covering various scenarios including document enqueuing, snapshot handling, and processing of non-document changes.
- Refactored replicator to utilize a logging function from the host API instead of a global logger, enhancing log management.
- Updated mismatchedTweaksResolver to include logging through the host API, ensuring consistent logging practices across the application.
- Adjusted tests to mock the new logging behavior and verify log outputs.
2026-06-26 09:36:48 +00:00

22 lines
880 B
TypeScript

import { createObsidianServiceFeature } from "@/types.ts";
import { createInstanceLogFunction } from "@lib/services/lib/logUtils.ts";
import type { ObsidianEventsServices, ObsidianEventsModules } from "./types.ts";
import { createObsidianEventsState } from "./state.ts";
import { bindObsidianEventsLifecycle } from "./eventBindings.ts";
/**
* A service feature hook that initialises and manages Obsidian application event bindings.
* This hooks into vault file changes, window focus, visibility states, and schedules restarts.
*/
export const useObsidianEvents = createObsidianServiceFeature<
ObsidianEventsServices,
ObsidianEventsModules,
"app" | "plugin",
void
>((host) => {
const log = createInstanceLogFunction("ObsidianEvents", host.services.API);
const state = createObsidianEventsState();
bindObsidianEventsLifecycle(host, log, state);
});