@koderlabs/tasks-sdk-vue
v0.2.0
Published
Vue 3 plugin for the InstantTasks SDK.
Readme
@koderlabs/tasks-sdk-vue
Runtime: browser DOM with Vue 3 only. Vue 2 is not supported.
Vue 3 plugin for the InstantTasks SDK. Initialises the core client at app.use(...) and wires app.config.errorHandler so unhandled Vue render errors are reported. Provides the client to the entire component tree via Vue's provide / inject.
Install
npm install @koderlabs/tasks-sdk @koderlabs/tasks-sdk-vue
# plus integrations as needed:
npm install @koderlabs/tasks-sdk-web-errors @koderlabs/tasks-sdk-web-network @koderlabs/tasks-sdk-web-reporterUsing pnpm or yarn:
pnpm add @koderlabs/tasks-sdk @koderlabs/tasks-sdk-vue
# or
yarn add @koderlabs/tasks-sdk @koderlabs/tasks-sdk-vuePeer: vue: ^3.
Usage
// main.ts
import { createApp } from 'vue';
import App from './App.vue';
import { createInstantTasksPlugin } from '@koderlabs/tasks-sdk-vue';
import { errorsIntegration } from '@koderlabs/tasks-sdk-web-errors';
import { reporterIntegration } from '@koderlabs/tasks-sdk-web-reporter';
createApp(App)
.use(
createInstantTasksPlugin({
projectId: 'FE',
accessKey: import.meta.env.VITE_IT_ACCESS_KEY,
integrations: [errorsIntegration(), reporterIntegration()],
}),
)
.mount('#app');Inside any component (Composition API):
import { injectInstantTasks } from '@koderlabs/tasks-sdk-vue';
const client = injectInstantTasks();
(client as any).errors?.notify(new Error('oops'));
(client as any).reporter?.show();API
| Export | Purpose |
|---|---|
| createInstantTasksPlugin(opts: InitOptions) | Factory returning a Vue 3 Plugin. Pass app.use(...). |
| injectInstantTasks(): Client | Composition-API helper. Throws if called outside setup() or when the plugin is not installed. |
| installInstantTasks(app, opts) | Lower-level installer that returns { client, uninstall }. Used by the plugin internally; call directly if you need an explicit teardown handle (Vite HMR / tests). |
| INSTANTTASKS_KEY | Vue injection key (rarely needed). |
Error-handler chain
installInstantTasks wraps any pre-existing app.config.errorHandler so the host's handler runs first, then the SDK observes/reports. This matches the framework-first convention used by Pinia, Vue Router, and vue-i18n.
On uninstall(), the original handler is restored — calling install/uninstall repeatedly does not stack wrappers.
Caveats
- Vue 2 is not supported. Peer dependency pins
vue: ^3. app.use(plugin)is idempotent in Vue butinit()itself is also idempotent — a re-mount tears down the prior client cleanly.injectInstantTasks()throws when called outsidesetup()(e.g. at module top-level) or when the plugin wasn't installed on the active app. Catch in tests if you need to.- Vue has no first-class "App unmount" event; if you need clean teardown (Vite HMR, tests), use
installInstantTasks(app, opts)and call the returneduninstall()yourself. - The plugin only catches errors that go through
app.config.errorHandler— unhandled promise rejections and globalwindow.onerrorneed@koderlabs/tasks-sdk-web-errors.
Suite overview
Full SDK suite map + platform availability matrix: docs/sdk/overview.md.
License
KoderLabs proprietary. See LICENSE for terms. Use of this package requires a separate signed written agreement with KoderLabs; access alone confers no rights.
Licensing inquiries: [email protected]
