@daltonr/notifywrite-vue
v0.3.0
Published
Vue adapter for @daltonr/notifywrite
Maintainers
Readme
@daltonr/notifywrite-vue
Vue 3 adapter for @daltonr/notifywrite — composables over the headless notification engine. State is a readonly computed; the engine is markRaw-ed so Vue never proxies it.
npm install @daltonr/notifywrite @daltonr/notifywrite-vue<script setup>
import { NotificationEngine } from "@daltonr/notifywrite";
import { provideNotifications, useNotifications } from "@daltonr/notifywrite-vue";
const engine = new NotificationEngine({ order: "newest-first" });
provideNotifications(engine); // descendants call injectNotifications()
const { notifications, add, dismiss } = useNotifications(engine);
</script>
<template>
<div v-for="n in notifications" :key="n.id" @click="dismiss(n.id)">{{ n.message }}</div>
</template>See the project README for the full engine API.
MIT © Richard Dalton
