i2 Notebook SDK
Search results for

    Show/hide table of contents

    Home > @i2analyze/notebook-sdk > app > ICancelation

    app.ICancelation interface

    A collection of methods and properties for handling the situation when a user cancels an operation.

    Signature:

    interface ICancelation 
    

    Introduced: version 1.1

    Remarks

    The i2 Notebook SDK provides two cancelation APIs: An AbortSignal-based API and a Promise-based API, which you can use depending on your scenario:

    • To launch an asynchronous operation (for example, a fetch call) that can itself be canceled by an AbortSignal, you can pass signal directly to that operation.

    • To launch an asynchronous operation that cannot itself be canceled but is to be abandoned if the user requests cancelation, call waitForPromiseOrCancel() with the Promise from your operation. The returned Promise resolves or rejects just as your operation's Promise does, and it rejects immediately with an AbortError if the user cancels the operation.

    To check synchronously if the operation has been canceled, you can inspect the signal.aborted property.

    Properties

    Property Modifiers Type Description
    signal AbortSignal Gets an AbortSignal that indicates whether a user has requested that an operation be canceled.

    Methods

    Method Description
    waitForPromiseOrCancel(promise) Launches an asynchronous operation through the specified promise.
    In this article
    Back to top © N. Harris Computer Corporation