types: improve type exports
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. `@vue/runtime-dom`), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.
|
||||
|
||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build reactivity --types` from repo root, which will generate an API report at `temp/reactivity.api.md`.
|
||||
|
||||
## Credits
|
||||
|
||||
The implementation of this module is inspired by the following prior art in the JavaScript ecosystem:
|
||||
|
||||
@@ -9,23 +9,21 @@ export interface ReactiveEffect {
|
||||
raw: Function
|
||||
deps: Array<Dep>
|
||||
computed?: boolean
|
||||
scheduler?: Scheduler
|
||||
onTrack?: Debugger
|
||||
onTrigger?: Debugger
|
||||
scheduler?: (run: Function) => void
|
||||
onTrack?: (event: DebuggerEvent) => void
|
||||
onTrigger?: (event: DebuggerEvent) => void
|
||||
onStop?: () => void
|
||||
}
|
||||
|
||||
export interface ReactiveEffectOptions {
|
||||
lazy?: boolean
|
||||
computed?: boolean
|
||||
scheduler?: Scheduler
|
||||
onTrack?: Debugger
|
||||
onTrigger?: Debugger
|
||||
scheduler?: (run: Function) => void
|
||||
onTrack?: (event: DebuggerEvent) => void
|
||||
onTrigger?: (event: DebuggerEvent) => void
|
||||
onStop?: () => void
|
||||
}
|
||||
|
||||
export type Scheduler = (run: () => any) => void
|
||||
|
||||
export interface DebuggerEvent {
|
||||
effect: ReactiveEffect
|
||||
target: any
|
||||
@@ -33,8 +31,6 @@ export interface DebuggerEvent {
|
||||
key: string | symbol | undefined
|
||||
}
|
||||
|
||||
export type Debugger = (event: DebuggerEvent) => void
|
||||
|
||||
export const activeReactiveEffectStack: ReactiveEffect[] = []
|
||||
|
||||
export const ITERATE_KEY = Symbol('iterate')
|
||||
|
||||
@@ -8,7 +8,12 @@ export {
|
||||
markReadonly,
|
||||
markNonReactive
|
||||
} from './reactive'
|
||||
export { computed, ComputedRef, WritableComputedOptions } from './computed'
|
||||
export {
|
||||
computed,
|
||||
ComputedRef,
|
||||
WritableComputedRef,
|
||||
WritableComputedOptions
|
||||
} from './computed'
|
||||
export {
|
||||
effect,
|
||||
stop,
|
||||
|
||||
Reference in New Issue
Block a user