UNPKG

@tvkitchen/countertop

Version:

The entry point for developers who want to set up a TV Kitchen.

48 lines (47 loc) 1.53 kB
import { Payload } from './Payload'; import type { PayloadType } from '../types'; export declare class PayloadArray { private readonly payloads; constructor(payloads?: Payload[]); length(): number; /** * Insert a Payload into the PayloadArray while maintaining position order. */ insert(payload: Payload): this; /** * Remove all payloads from the PayloadArray. */ empty(): this; /** * Find the index to which a payload with a given position would be inserted. */ indexOfPosition(position: number, returnHighest?: boolean): number; /** * Create a new PayloadArray containing only Payloads of the specified types. */ filterByTypes(types: (PayloadType | string)[]): PayloadArray; /** * Create a new PayloadArray containing only Payloads of the specified type. */ filterByType(type: PayloadType | string): PayloadArray; /** * Create a new PayloadArray containing only Payloads that exist within a specified duration. */ filterByPosition(start: number, end?: number): PayloadArray; /** * Copy the content of the PayloadArray to a vanilla Array. */ toArray(): Payload[]; /** * Get the earliest position represented in this PayloadArray. */ getPosition(): number; /** * Get the origin timestamp of this PayloadArray. */ getOrigin(): string; /** * Get the duration represented by the payloads in this PayloadArray. */ getDuration(): number; }