---
title: "InstancePool | Weather SDK | JavaScript maps SDK"
description: "Documentation for Weather JS"
---

# Class InstancePool<T>

#### Type Parameters

-   T

##### Index

### Constructors

[constructor](#constructor)

### Methods

[add](#add) [init](#init) [isEmpty](#isempty) [pop](#pop) [reset](#reset)

## Constructors

### constructor[](#constructor)

-   new InstancePool<[T](#constructorinstancepoolt)\>(): InstancePool<[T](#t)\>[](#constructorinstancepool)
    
    #### Type Parameters
    
    -   T
    
    #### Returns InstancePool<[T](#t)\>
    

## Methods

### add[](#add)

-   add(obj: [T](#t), isAvailable?: boolean): [T](#t)[](#add-1)
    
    Add an instance to the pool
    
    #### Parameters
    
    -   obj: [T](#t)
    -   `Optional`isAvailable: boolean
        
        make it available when true (default: false)
        
    
    #### Returns [T](#t)
    

### init[](#init)

-   init(): void[](#init-1)
    
    Make all the instances available again
    
    #### Returns void
    

### isEmpty[](#isempty)

-   isEmpty(): boolean[](#isempty-1)
    
    Check if there are still available instances in the pool.
    
    #### Returns boolean
    

### pop[](#pop)

-   pop(): [T](#t)[](#pop-1)
    
    Pops one instance from the pool.
    
    #### Returns [T](#t)
    
    #### Throw[](#throw)
    
    when the pool of available instances is empty. Use `.isEmpty()` to test.
    

### reset[](#reset)

-   reset(): void[](#reset-1)
    
    Remove all elements
    
    #### Returns void
