---
title: "Scheduler | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

# Interface Scheduler

The **`Scheduler`** interface of the Prioritized Task Scheduling API provides methods for scheduling prioritized tasks.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler)

interface Scheduler {  
    [postTask](#posttask-1)(  
        callback: [SchedulerPostTaskCallback](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SchedulerPostTaskCallback/),  
        options?: [SchedulerPostTaskOptions](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SchedulerPostTaskOptions/),  
    ): Promise<any\>;  
    [yield](#yield-1)(): Promise<void\>;  
}

##### Index

### Methods[](#methods)

[postTask](#posttask) [yield](#yield)

## Methods[](#methods-1)

### postTask[](#posttask)

-   postTask(  
        callback: [SchedulerPostTaskCallback](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SchedulerPostTaskCallback/),  
        options?: [SchedulerPostTaskOptions](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SchedulerPostTaskOptions/),  
    ): Promise<any\>[](#posttask-1)
    
    The **`postTask()`** method of the Scheduler interface is used for adding tasks to be scheduled according to their priority.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler/postTask)
    
    #### Parameters
    
    -   callback: [SchedulerPostTaskCallback](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SchedulerPostTaskCallback/)
    -   `Optional`options: [SchedulerPostTaskOptions](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.SchedulerPostTaskOptions/)
    
    #### Returns Promise<any\>
    

### yield[](#yield)

-   yield(): Promise<void\>[](#yield-1)
    
    The **`yield()`** method of the Scheduler interface is used for yielding to the main thread during a task and continuing execution later, with the continuation scheduled as a prioritized task (see the Prioritized Task Scheduling API for more information). This allows long-running work to be broken up so the browser stays responsive.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler/yield)
    
    #### Returns Promise<void\>
