@idooel/runtime-context
Version:
Runtime data pool with namespaces, stackable contexts, subscriptions and optional persistence. Vue adapter included.
30 lines (26 loc) • 704 B
text/typescript
import Vue from 'vue'
import type { DataPool } from '../core/DataPool'
import type { Namespace, DataKey, Subscriber, DataEvent } from '../core/types'
declare module 'vue/types/vue' {
interface Vue {
$idooelDataPool: DataPool
_idooelDataPoolSubscriptions?: Array<() => void>
}
}
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
dataPool?: {
[key: string]: { ns: Namespace; key: DataKey; fallback?: unknown }
}
}
}
export interface Vue2DataPoolOptions {
pool?: DataPool
globalInject?: boolean
mixin?: boolean
}
export interface PoolValueComposable<T = unknown> {
value: T | undefined
set: (value: T) => void
delete: () => void
}