interface · Browser and Node

# Scheduler

Where the mesh gets time and timers. Tests use VirtualScheduler, a clock that jumps from event to event.

`@toip-tools/mesh-transport` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/mesh-transport/src/scheduler.ts#L3)

Import:

```ts
import { type Scheduler } from "@toip-tools/mesh-transport";
```

## Declaration

interface:

```ts
interface Scheduler {
  now(): number;
  setTimeout(fn: () => void, ms: number): unknown;
  clearTimeout(handle: unknown): void;
}
```

## Methods

### `now`

Signature:

```ts
now(): number;
```

No parameters.

#### Returns

`number`

### `setTimeout`

Signature:

```ts
setTimeout(fn: () => void, ms: number): unknown;
```

#### Parameters

- **`fn` (required)**: `() => void`
- **`ms` (required)**: `number`

#### Returns

`unknown`

### `clearTimeout`

Signature:

```ts
clearTimeout(handle: unknown): void;
```

#### Parameters

- **`handle` (required)**: `unknown`

#### Returns

`void`

[Usage guide](https://toip.tools/toolkit/mesh-transport/#usage) · [Error handling](https://toip.tools/toolkit/mesh-transport/#errors) · [All exports](https://toip.tools/toolkit/mesh-transport/api/)

---

This is the Markdown version of https://toip.tools/toolkit/mesh-transport/api/Scheduler/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
