• Returns a function that will call the reverse action automatically with the last argument called with it before calling the action with the current argument.

    Suitable for things like tabs and selections...

    Parameters

    • action: Function
    • reverseAction: Function

    Returns ((arg) => any)

      • (arg): any
      • Parameters

        • arg: any

        Returns any

    Example

    import { rev } from 'deleight/function'
    const hide = (dialog: HTMLDialogElement) => dialog.style.display = 'none';
    const show = rev(
    (dialog: HTMLDialogElement) => dialog.style.display = null,
    hide
    );
    show(document.querySelector('#dialog1'));
    show(document.querySelector('#dialog2')); // dialog 1 is hidden automatically
    show(document.querySelector('#dialog3')); // dialog 2 is hidden automatically