poller.svelte.ts

Declarations
#

2 declarations

view source

Poller
#

poller.svelte.ts view source

Helper class to manage polling intervals. Automatically cleans up on disposal.

DEFAULT_INTERVAL

static

constructor

type new (options: PollerOptions): Poller

options

start

Start polling with optional overrides.

type (options?: { immediate?: boolean | undefined; interval?: number | undefined; } | undefined): void

options?
type { immediate?: boolean | undefined; interval?: number | undefined; } | undefined
optional
returns void

stop

Stop polling.

type (): void

returns void

set_interval

Update the polling interval. If polling is active, it will restart with the new interval. No-op if the interval is already set to the same value.

type (interval: number | undefined): void

interval
type number | undefined
returns void

dispose

Dispose of the poller, stopping any active polling.

type (): void

returns void

PollerOptions
#

poller.svelte.ts view source

PollerOptions

poll_fn

Function to call on each poll interval.

type () => void | Promise<void>

interval

Polling interval in milliseconds.

type number

immediate

Whether to run the poll function immediately on start, defaults to true.

type boolean

Imported by
#