uiconfig.js API
    Preparing search index...

    Class UiConfigMethods

    Index
    undoEditingWaitTime: number = 2000
    undoPresets: {
        UiConfigMethods_action: (
            c: ActionCommand,
        ) => { redo: () => Promise<void>; undo: () => Promise<void> };
        UiConfigMethods_set: (
            c: SetValueCommand,
        ) => { redo: () => void; undo: () => void };
    } = ...
    DefaultDispatchMode: TUiRefreshModes | "immediate" = 'immediate'
    • Performs an action with undo/redo support, with the undo manager of the renderer. See PerformAction.

      Type Parameters

      • T extends AnyFunction

      Parameters

      Returns Promise<void>

    • Type Parameters

      Parameters

      • config: UiObjectConfig<T>
      • value: T
      • props: {
            config?: UiObjectConfig<any, string, any>;
            configPath?: UiObjectConfig<any, string, any>[];
            last?: boolean;
            lastValue?: any;
            value?: any;
        }
      • OptionalforceOnChange: boolean
      • trackUndo: boolean = true

      Returns Promise<boolean>

    • Adds a function that config.uiRefresh(deep, mode, delay) calls. Each renderer that draws a config adds its own (UiConfigRendererBase.addRefreshListener does it for a renderer), so a config drawn by more than one renderer refreshes in all of them. Callers keep calling config.uiRefresh?.(deep, mode, delay).

      A function assigned with config.uiRefresh = fn is called too; assigning undefined removes only that function. The listeners are not enumerable: JSON, a spread and Object.assign leave them out.

      Parameters

      Returns () => void

      a function that removes the listener

    • Get the value from config

      Type Parameters

      Parameters

      • config: UiObjectConfig<T>
      • val: T | undefined

        existing value, new value can be copied to this if not equal.

      • copyOnEqual: boolean = true

        whether the value should be copied to val if equal. Default is true.

      Returns T | undefined

      The value from the binding, cloned or copied if possible. If the value is equal and copyOnEqual is false, then undefined is returned. this can be used to check if the value is changed

    • Performs an action with undo/redo support.

      The action can return:

      1. an undo function: undo calls it, and redo runs the action again; the undo function that this run returns undoes it (the next undo calls that one).
      2. an object with undo and optional redo and action: action (if any) runs now. Undo calls undo and redo calls redo (else action, else it runs the action again, as in 1). They are read from the object when the step is undone or redone, not when it is recorded, so an action can replace them (for example an undo that sets the redo that brings back the same object).

      With an undo manager, the action is one undo step (when it returns an undo).

      Type Parameters

      • T extends AnyFunction

      Parameters

      • targ: any

        the target object to call the action on

      • action: T

        a function that returns - 1. an undo function, 2. an object with undo and redo functions (and optional action)

      • args: Parameters<T>

        the arguments to pass to the action function

      • config: UiObjectConfig

        ui config

      • OptionalonUndoRedo: (c: ActionCommand) => void

        optional callback function to be called on undo/redo of the command. Not called on first action execution, only on undo/redo.

      • Optionalum: JSUndoManager

        the undo manager that records the step

      • OptionalundoEditingWaitTime: number
      • OptionalonPending: () => void

        called once, synchronously, when the action (or the action of the object that it returns) returns a promise, before it settles: for example to show that a button runs. Not called for a synchronous action, or for a redo.

      Returns Promise<void>

    • Binds a child config to the binding of its parent (a folder with property or value) when the child has no binding of its own (no property, value, getValue or setValue) and is not a button: the child gets the parent's property (or [parent, 'value']), and its path then selects a value inside it. Renderers call it for each child before drawing it (uiconfig-tweakpane, uiconfig.js/dom).

      Parameters

      Returns void

    • Type Parameters

      Parameters

      • config: UiObjectConfig<T>
      • value: T
      • props: {
            config?: UiObjectConfig<any, string, any>;
            configPath?: UiObjectConfig<any, string, any>[];
            last?: boolean;
            lastValue?: any;
            value?: any;
        }

        only the prop last need to be set, rest are optional. lastValue can be set if known (but it should be exactly equal to the value in the binding and not cloned).

      • OptionalforceOnChange: boolean
      • trackUndo: boolean = true
      • Optionaldispatcher: UiConfigRendererBase
      • Optionalum: JSUndoManager
      • OptionalundoEditingWaitTime: number

      Returns Promise<boolean>