2025-12-12 20:36:39 +09:00
|
|
|
import type { BackgroundManager } from "../../features/background-agent"
|
2025-12-11 16:12:14 +09:00
|
|
|
|
|
|
|
|
interface Event {
|
|
|
|
|
type: string
|
|
|
|
|
properties?: Record<string, unknown>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface EventInput {
|
|
|
|
|
event: Event
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createBackgroundNotificationHook(manager: BackgroundManager) {
|
|
|
|
|
const eventHandler = async ({ event }: EventInput) => {
|
|
|
|
|
manager.handleEvent(event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
event: eventHandler,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type { BackgroundNotificationHookConfig } from "./types"
|