active()

    active()


    Article summary

    active()

    A portion of the X1 JavaScript API is loaded asynchronously. The active method, when combined with the onMoneyBadgerReady event listener, will allow you to ensure that calls to the X1 JavaScript API succeed during this window without blocking your own X1 App code.

    Signature:

    $badger.active()

    Parameters:

    None.

    Return Values:

    DescriptionTypeResult
    The X1 JavaScript API is ready (fully initialized)booleantrue
    The X1 JavaScript API is not ready (not fully initialized)booleanfalse

    Usage Example:

    if ($badger && $badger.active()) {
        // use the X1 JavaScript API
    } else {
        document.addEventListener('onMoneyBadgerReady', () => {
            // use the X1 JavaScript API
        })
    }
    

    Was this article helpful?