跳至内容

usePrimitiveScope

将“PrimitiveCollection”操作的副作用范围化,并在卸载时自动删除

Usage

ts
TODO;

Type Definitions

typescript
import type { PrimitiveCollection } from 'cesium';
import type { MaybeRefOrGetter } from 'vue';
export interface UsePrimitiveScopeOptions {
    /**
     * The collection of Primitive to be added,
     * 'ground' alias `useViewer().value.scene.groundPrimitives`
     * @default useViewer().value.scene.primitives
     */
    collection?: MaybeRefOrGetter<PrimitiveCollection | 'ground' | undefined>;
}
/**
 * Make `add` and `remove` operations of `PrimitiveCollection` scoped,
 * automatically remove `Primitive` instance when component is unmounted.
 */
export declare function usePrimitiveScope(options?: UsePrimitiveScopeOptions): {
    scope: Readonly<import("vue").ShallowReactive<Set<any>>>;
    add: <R extends any>(instance: R, ...args: any[]) => R extends Promise<infer U> ? Promise<U> : any;
    remove: (instance: any, ...args: any[]) => any;
    removeWhere: (predicate: import("..").EffcetRemovePredicate<any>, ...args: any[]) => void;
    removeScope: (...args: any[]) => void;
};
//# sourceMappingURL=index.d.ts.map