usePostProcessStageScope
将“PostProcessStageCollection”操作的副作用范围化,并在卸载时自动删除
Usage
ts
TODO;
Type Definitions
typescript
import type { PostProcessStage, PostProcessStageCollection } from 'cesium';
import type { MaybeRefOrGetter, ShallowReactive } from 'vue';
import type { EffcetRemovePredicate } from '../useCollectionScope';
export interface UsePostProcessStageScopeOptions {
/**
* The collection of PostProcessStage to be added
* @default useViewer().value.postProcessStages
*/
collection?: MaybeRefOrGetter<PostProcessStageCollection>;
}
export interface UsePostProcessStageScopeRetrun {
/**
* A `Set` for storing SideEffect instance,
* which is encapsulated using `ShallowReactive` to provide Vue's reactive functionality
*/
scope: Readonly<ShallowReactive<Set<PostProcessStage>>>;
/**
* Add SideEffect instance
*/
add: <T extends PostProcessStage>(postProcessStage: T) => T;
/**
* Remove specified SideEffect instance
*/
remove: (postProcessStage: PostProcessStage, destroy?: boolean) => boolean;
/**
* Remove all SideEffect instance that meets the specified criteria
*/
removeWhere: (predicate: EffcetRemovePredicate<PostProcessStage>, destroy?: boolean) => void;
/**
* Remove all SideEffect instance within current scope
*/
removeScope: (destroy?: boolean) => void;
}
/**
* Make `add` and `remove` operations of `PostProcessStageCollection` scoped,
* automatically remove `PostProcessStage` instance when component is unmounted.
*/
export declare function usePostProcessStageScope(options?: UsePostProcessStageScopeOptions): UsePostProcessStageScopeRetrun;