/** * The shortest cycle the clock-driven builtins will honour, regardless of how fine the host's clock is. * A shorter one would let an expression ask for a strobe (a `square` wave at 100ms already toggles at * 10Hz), and a cycle of 0 would hand the host a division by zero. A coarse clock raises this floor * further, but nothing lowers it. */ export declare const MIN_CLOCK_PERIOD_MS = 100; /** The portion of each interval `blink()` spends in its "on" state when the expression does not say. */ export declare const BLINK_DEFAULT_DUTY_CYCLE = 0.5; /** * Build the `blink` builtin around a host-supplied on/off state. The arguments are validated here so * every host sees the same canonical numbers - `blink('1000')` and `blink(1000)` are the same blink, * which also matters where the host derives a key or a dependency from them. */ export declare function buildBlinkFunction(isOn: (intervalMs: number, dutyCycle: number) => boolean): (interval: any, dutyCycle?: any) => 0 | 1; /** The host clock backing `oscillate()`. */ export interface OscillateClock { /** * Given the period of the oscillation in milliseconds (already validated and clamped), return the * current position within that cycle as a fraction: 0 at the start of a cycle, approaching 1 at the * end. Values outside 0-1 are wrapped. * * Aligning the fraction to the unix epoch keeps separate evaluations of the same period in sync. */ getCycleFraction: (periodMs: number) => number; /** * How far apart consecutive samples of that clock can be - typically `1000 / redraw rate`, and the * same figure the host quantises its own clock to (Companion redraws at 10Hz, so it passes 100). * * It raises the effective minimum period, and is how far before the end of the cycle the `sawtooth` * ramp reaches 1 - without that the ramp would jump from its last sampled value straight back to 0 and * never actually reach full scale. Omit for a continuous clock. */ granularityMs?: number; } /** * Build the `oscillate` builtin around a host-supplied clock. The phase offset and waveform shaping are * applied on top of the clock here, so a host only has to say where it is in the cycle and how finely it * can tell. * * Rebuilt per evaluation so the clock stays current, in the same way as the date functions. */ export declare function buildOscillateFunction(clock: OscillateClock): (period: any, waveform?: any, phase?: any) => number; /** * Get the set of expression functions, with date/time functions defaulting to the given timezone when * no explicit `tz` argument is passed. * * The timezone may be supplied either as a plain IANA name (or undefined/empty for the process-local * timezone), or as a getter function. A getter lets callers resolve the timezone lazily and, in Companion, * register a dependency on the active timezone so expressions re-evaluate when it changes. * * `defaultLocale` works the same way, and controls the month/weekday names `dateFormat` produces when no * explicit locale argument is given. Leaving it unset (or supplying an empty/unsupported value) uses the * runtime's own locale, which matches what `Date.toLocaleString` gives the `internal:date_weekday` * variable -- so a caller that has no locale setting of its own can simply omit it. * * Note: when adding new functions, make sure to update the docs! * * @param defaultTimezone IANA timezone name (or undefined/empty for process-local), or a getter for it * @param defaultLocale BCP 47 locale tag (or undefined/empty for the runtime locale), or a getter for it */ export declare function createExpressionFunctions(defaultTimezone: string | (() => string | undefined) | undefined, defaultLocale?: string | (() => string | undefined)): Record any>; /** * Name of the builtin expression functions */ export declare const BuiltinFunctionNames: string[]; //# sourceMappingURL=ExpressionFunctions.d.ts.map