Interface LayoutTriggerConfig

interface LayoutTriggerConfig {
    actOn?: Element;
    delay?: number;
    doDelay?: number;
    id?: string;
    layout:
        | DeviceSpec
        | AspectRatioSpec
        | ("mobile" | "mobile-wide" | "tablet" | "desktop")[]
        | ("square" | "very-tall" | "tall" | "wide" | "very-wide")[];
    once?: boolean;
    oneWay?: boolean;
    root?: null | HTMLElement;
    undoDelay?: number;
}

Properties

actOn?: Element

The element to instantiate all actions on this trigger for.

The element on which the Trigger is defined

delay?: number

Delay in milliseconds before doing, undoing or toggling actions.

0
doDelay?: number

Delay in milliseconds before doing actions.

TriggerConfig.delay

id?: string

An ID for the trigger so that it can be looked up by ID. It has to be unique for each element, but you can use the same ID on different elements.

undefined
layout:
    | DeviceSpec
    | AspectRatioSpec
    | ("mobile" | "mobile-wide" | "tablet" | "desktop")[]
    | ("square" | "very-tall" | "tall" | "wide" | "very-wide")[]

The DeviceSpec or AspectRatioSpec to use. Required. See OnLayoutOptions for accepted formats.

Actions will be "done" when the layout of the root matches the given spec and "undone" otherwise.

once?: boolean

If true, the trigger will run at most once. This will result in the run or toggle methods removing all three of run, reverse and toggle when called, so that the actions are done at most once.

false
oneWay?: boolean

If true, then the reverse method of the trigger will do nothing and the toggle method will always do the actions, i.e. will be equivalent to run.

false
root?: null | HTMLElement

The root to use for the LayoutWatcher. See LayoutWatcherConfig

LayoutWatcher default, the viewport

undoDelay?: number

Delay in milliseconds before undoing actions.

TriggerConfig.delay