mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-06-27 00:23:56 +00:00
559c3f351b
- 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.
22 lines
880 B
TypeScript
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);
|
|
});
|