Files
stats/packages/sdks/nuxt/src/runtime/plugin.client.ts
Carl-Gerhard Lindesvärd 1f088d2208 feat: add nuxt sdk (#260)
* wip

* fix: improve api route for nuxt
2026-01-07 10:28:11 +01:00

31 lines
617 B
TypeScript

import { OpenPanel } from '@openpanel/web';
import { defineNuxtPlugin, useRuntimeConfig } from '#app';
import type { ModuleOptions } from '../types';
declare module '#app' {
interface NuxtApp {
$openpanel: OpenPanel;
}
}
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$openpanel: OpenPanel;
}
}
export default defineNuxtPlugin({
name: 'openpanel',
parallel: true,
setup() {
const config = useRuntimeConfig().public.openpanel as ModuleOptions;
const op = new OpenPanel(config);
return {
provide: {
openpanel: op,
},
};
},
});