docs/.vitepress/theme/composables/op.ts

5a837a5930af05cb8b7b0617cd0a9290534fa2f7
wotaku/docs/.vitepress/theme/composables/op.ts

28 lines · 788 bytes

 1/**
 2 *  All Rights Reserved
 3 *
 4 *  Copyright (c) 2025 taskylizard
 5 *
 6 *  All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
 7 */
 8import type { App, InjectionKey } from 'vue'
 9import { Internal } from '../internal/browser'
10
11export const opSymbol: InjectionKey<Internal> = Symbol('op')
12
13export function createOpProvider(app: App) {
14  // Disable in dev
15  if (import.meta.env.DEV) return
16
17  const op = new Internal({
18    clientId: 'e0e39d6b-2692-45a0-9422-4d668f113f70',
19    trackScreenViews: true,
20    trackOutgoingLinks: true,
21    trackAttributes: true,
22    trackHashChanges: true
23  })
24
25  op.init()
26
27  app.provide(opSymbol, op)
28}