Uneventful
    Preparing search index...
    • Wrap a function in a Checkpoint that resets each time the resulting function is called, thereby canceling any in-progress subtasks and cleaning up any resources used by previous calls. (This can be useful for such things as canceling an in-progress search when the user types more text in a field.)

      The checkpoint will be ended when the context that invoked restarting() is finished, canceled, or reset. Calling the wrapped function after its checkpoint has ended will result in an error. You can wrap any function any number of times: each call to restarting() creates a new, distinct checkpoint and function wrapper to go with it.

      Type Parameters

      Parameters

      • action: F

        (Optional) The function to be wrapped. This can be any function: the returned wrapper function will match its call signature exactly, including overloads. (So for example you could wrap the start API via restarting(start), to create a function you can pass ActivityFn functions to. When called, the function would cancel any outstanding task from a previous call, and start the new one in its place.)

      Returns F

      A function of identical type to the input function. If no input function was given, the returned function will just take one argument (a zero-argument function optionally returning a CleanupFn), and will run it in the checkpoint's context.

    • Wrap a function in a Checkpoint that resets each time the resulting function is called, thereby canceling any in-progress subtasks and cleaning up any resources used by previous calls. (This can be useful for such things as canceling an in-progress search when the user types more text in a field.)

      The checkpoint will be ended when the context that invoked restarting() is finished, canceled, or reset. Calling the wrapped function after its checkpoint has ended will result in an error. You can wrap any function any number of times: each call to restarting() creates a new, distinct checkpoint and function wrapper to go with it.

      Returns (action: () => OptionalCleanup) => void

      A function of identical type to the input function. If no input function was given, the returned function will just take one argument (a zero-argument function optionally returning a CleanupFn), and will run it in the checkpoint's context.