Lens Scripting API
    Preparing search index...

    Defines the configuration for creating an ObjectPool.

    interface ObjectPoolConfig<T> {
        factory: () => T;
        growthFactor?: number;
        initialCapacity?: number;
        minGrowthAmount?: number;
        onGet?: (item: T) => void;
        onRelease?: (item: T) => void;
        parentTag?: string;
    }

    Type Parameters

    • T
    Index

    Properties

    factory: () => T

    A function that creates a new object for the pool. This is called when the pool needs to grow.

    growthFactor?: number

    The factor by which the pool should grow when it runs out of items, based on its current capacity.

    0.5 (50%)
    
    initialCapacity?: number

    The initial number of objects to create and pre-allocate in the pool.

    0
    
    minGrowthAmount?: number

    The minimum number of new items to create when the pool needs to grow.

    10
    
    onGet?: (item: T) => void

    An optional function that is called on an object immediately after it is retrieved from the pool. Use this to reset the object's state.

    onRelease?: (item: T) => void

    An optional function that is called when an object is returned to the pool. Use this to clean up or reset the object's state.

    parentTag?: string

    An optional parent tag for hierarchical logging. If provided, logs will show as "parentTag:ObjectPool".

    undefined