Class KeysBinder<C, I, A, D>

The base binding builder to create bindings between a keys pressure interaction and a given command.

Type Parameters

Hierarchy

Implements

Constructors

Properties

accInit: undefined | A
bindingName: undefined | string
cancelFn?: ((i, acc) => void)

Type declaration

    • (i, acc): void
    • Parameters

      • i: D
      • acc: A

      Returns void

cancelFnArray: ((i, acc) => void)[] = []

Type declaration

    • (i, acc): void
    • Parameters

      • i: D
      • acc: A

      Returns void

cannotExecFn?: ((c, i, acc) => void)

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

cannotExecFnArray: ((c, i, acc) => void)[] = []

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

continuousCmdExecution: boolean
dynamicNodes: readonly Node[]
endFn?: ((c, i, acc) => void)

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

endFnArray: ((c, i, acc) => void)[] = []

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

endOrCancelFn?: ((i, acc) => void)

Type declaration

    • (i, acc): void
    • Parameters

      • i: D
      • acc: A

      Returns void

endOrCancelFnArray: ((i, acc) => void)[] = []

Type declaration

    • (i, acc): void
    • Parameters

      • i: D
      • acc: A

      Returns void

firstFn?: ((c, i, acc) => void)

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

firstFnArray: ((c, i, acc) => void)[] = []

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

hadEffectsFn?: ((c, i, acc) => void)

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

hadEffectsFnArray: ((c, i, acc) => void)[] = []

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

hadNoEffectFn?: ((c, i, acc) => void)

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

hadNoEffectFnArray: ((c, i, acc) => void)[] = []

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

isCode: boolean
keysOrCodes: readonly string[]
linterRules: Map<RuleName, Severity>
logLevels: readonly LogLevel[]
logger: Logger
observer: undefined | BindingsObserver
onErrFn?: ((ex) => void)

Type declaration

    • (ex): void
    • Parameters

      • ex: unknown

      Returns void

onErrFnArray: ((ex) => void)[] = []

Type declaration

    • (ex): void
    • Parameters

      • ex: unknown

      Returns void

prevDefault: boolean
produceFn?: ((i) => C)

Type declaration

    • (i): C
    • Parameters

      • i: undefined | D

      Returns C

stopPropagation: boolean
thenFn?: ((c, i, acc) => void)

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

thenFnArray: ((c, i, acc) => void)[] = []

Type declaration

    • (c, i, acc): void
    • Parameters

      • c: C
      • i: D
      • acc: A

      Returns void

throttleTimeout: number
undoHistory: UndoHistoryBase
usingFn?: (() => I)

Type declaration

    • (): I
    • Returns I

whenFnArray: When<D, A>[] = []
widgets: readonly unknown[]

Methods

  • Defines what to do when a command is cancelled (because the interaction is cancelled). The undoable command is automatically cancelled so that nothing must be done on the command. A binder can have several cummulative 'cancel' routines.

    Parameters

    • fn: ((i, acc) => void)
        • (i, acc): void
        • Parameters

          • i: D
          • acc: A

          Returns void

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Allows the processing of errors during the execution of the binding. Errors reported here are errors thrown in arrow functions provided to the the different routines of the binder and errors triggered by the command. A binder can have several cummulative 'catch' routines.

    Parameters

    • fn: ((ex) => void)

      The function to process the error caught by the binding during its execution

        • (ex): void
        • Parameters

          • ex: unknown

          Returns void

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Defines actions to perform when a binding ends. A binder can have several cummulative 'end' routines.

    Parameters

    • fn: ((c, i, acc) => void)

      The command to execute on each binding end.

        • (c, i, acc): void
        • Parameters

          • c: C
          • i: D
          • acc: A

          Returns void

    Returns KeysBinder<C, I, A, D>

    A clone of the current builder to chain the building configuration.

  • Defines what to do when a command is cancelled (because the interaction is cancelled). The undoable command is automatically cancelled so that nothing must be done on the command. A binder can have several cummulative 'endOrCancel' routines.

    Parameters

    • fn: ((i, acc) => void)
        • (i, acc): void
        • Parameters

          • i: D
          • acc: A

          Returns void

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Specifies the initialisation of the command when the interaction starts. Each time the interaction starts, an instance of the command is created and configured by the given callback. A binder can have several cummulative 'first' routines.

    Parameters

    • fn: ((c, i, acc) => void)

      The callback method that initialises the command. This callback takes as arguments the command to configure.

        • (c, i, acc): void
        • Parameters

          • c: C
          • i: D
          • acc: A

          Returns void

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Specifies what to do end when an interaction ends and the command could not be executed. A binder can have several cummulative 'ifCannotExecute' routines.

    Parameters

    • fn: ((c, i, acc) => void)

      The callback method to specify what to do when an interaction ends and the command could not be executed.

        • (c, i, acc): void
        • Parameters

          • c: C
          • i: D
          • acc: A

          Returns void

    Returns KeysBinder<C, I, A, D>

    The binder to chain the building configuration.

  • Specifies what to do end when an interaction ends (after the end/endOrCancel routines) and the command has produced an effect. A binder can have several cummulative 'ifHadEffects' routines.

    Parameters

    • fn: ((c, i, acc) => void)

      The callback method to specify what to do when an interaction ends and the command produced an effect.

        • (c, i, acc): void
        • Parameters

          • c: C
          • i: D
          • acc: A

          Returns void

    Returns KeysBinder<C, I, A, D>

    The binder to chain the building configuration.

  • Specifies what to do end when an interaction ends (after the end/endOrCancel routines) and the command did not produce an effect. A binder can have several cummulative 'ifHadNoEffect' routines.

    Parameters

    • fn: ((c, i, acc) => void)

      The callback method to specify what to do when an interaction ends and the command did not produce an effect.

        • (c, i, acc): void
        • Parameters

          • c: C
          • i: D
          • acc: A

          Returns void

    Returns KeysBinder<C, I, A, D>

    The binder to chain the building configuration.

  • Specifies the widgets on which the binding will operate. When a widget is added to this list, this widget is binded to this binding. When widget is removed from this list, this widget is unbinded from this binding.

    Type Parameters

    • W

    Parameters

    • widget: Widget<W> | readonly Widget<W>[]

      The mandatory first widget

    • Rest ...widgets: readonly Widget<W>[]

      The list of the widgets involved in the bindings.

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Permits to update the command on each interaction update. A binder can have several cummulative 'then' routines. This routine is called only if 'when' returns true (ie only if the condition for producing the command is respected). See 'ifCannotExecute' for a 'then' when this condition is not respected.

    Parameters

    • fn: ((c, i, acc) => void) | ((c) => void)

      The callback method that updates the command. This callback takes as arguments the command to update.

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Backpressure operation. Instead of emitting all the events, successive events of the same type are factorized modulo a timeout. The timeout is used to send at max one event of the same type in a given duration (the timeout). For example with three mouse moves and a time out of 10ms. The first move is received and processed. The timer starts. A second mouse moves is received at T+5ms. It is for the moment not processed. A third mouse move is received at T+8ms. The second move is finally ignored and this third one not processed yet. At T+10s the third event is finally processed. Based on our own experiments, the given timeout value should be greater than 10ms to throttle some UI events.

    Parameters

    • timeout: number

      The timeout used by the throttle operation. In ms.

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Specifies the conditions to fulfill to initialise, update, or execute the command while the interaction is running. A binder can have several cummulative 'when' routines.

    Parameters

    • fn: (() => boolean) | ((i, acc) => boolean)

      The predicate that checks whether the command can be initialised, updated, or executed. This predicate takes as arguments the data of the ongoing user interaction involved in the binding.

    • Optional mode: WhenType

    Returns KeysBinder<C, I, A, D>

    A clone of the current binder to chain the building configuration.

  • Defines the key values the binding will check. On a key interaction, the pressed keys will be checked against the given key values. The set of pressed keys must match the given key values.

    Parameters

    Returns KeysBinder<C, I, A, D>

    A clone of the current builder to chain the building configuration.

Generated using TypeDoc