Class: NewtonSDK

NewtonSDK

NewtonSDK

<private> new NewtonSDK()

NewtonSDK
Source:

Methods

__temporaryCustomLogin(userId)

Login through userId. No check is made.
Parameters:
Name Type Description
userId String The user id or null to logout
Deprecated:
  • This method will throw an exception when the real implementation is done
    Source:

    flowBegin(name, customData)

    Begin a flow. Close a previous flow with a fail if need.
    Parameters:
    Name Type Argument Description
    name String The name of the flow
    customData SimpleObject <optional>
    Some data
    Source:

    flowCancel(name, customData)

    End a flow with a cancellation
    Parameters:
    Name Type Argument Description
    name String The reason of the cancellation
    customData SimpleObject <optional>
    Some data
    Source:
    Throws:
    Throw if there's not a begun flow

    flowFail(name, customData)

    End a flow with a failure
    Parameters:
    Name Type Argument Description
    name String The reason of the failure
    customData SimpleObject <optional>
    Some data
    Source:
    Throws:
    Throw if there's not a begun flow

    flowStep(name, customData)

    Make a step for a flow
    Parameters:
    Name Type Argument Description
    name String The name of the step
    customData SimpleObject <optional>
    Some data
    Source:
    Throws:
    Throw if there's not a begun flow

    flowSucceed(name, customData)

    End a flow with a success
    Parameters:
    Name Type Argument Default Description
    name String <optional>
    "ok" A name that identify the end
    customData SimpleObject <optional>
    Some data
    Source:
    Throws:
    Throw if there's not a begun flow

    flushEvents(callback)

    Flush event queue
    Parameters:
    Name Type Description
    callback NewtonSDK~flushEventsCallback The callback called when the request is done
    Deprecated:
    • Yes
    Source:

    getLoginBuilder()

    Return a login builder
    Source:
    Returns:
    LoginBuilder

    isUserLogged() → {Boolean}

    Return true if Newton has a set userId
    Source:
    Returns:
    - true if the userId is set
    Type
    Boolean

    logException(error)

    Log exception to Sentry if is configured
    Parameters:
    Name Type Description
    error Error The error
    Source:
    Throws:
    Throw if there's not a begun flow

    sendEvent(name, customData)

    Queue an event
    Parameters:
    Name Type Argument Description
    name String The name of this event
    customData SimpleObject <optional>
    Some data attached to this event
    Source:

    timedEventStart(name, customData)

    Start a timed event
    Parameters:
    Name Type Argument Description
    name String The name of the timed event
    customData SimpleObject <optional>
    Some data
    Source:

    timedEventStop(name, customData)

    Stop a timed event. The event has a merge of this customData and the customData passed on timedEventStart method
    Parameters:
    Name Type Argument Description
    name String The name of this event
    customData SimpleObject <optional>
    Some data
    Source:
    Throws:
    Throw if there's no started event the given name

    Type Definitions

    flushEventsCallback(err)

    This callback is used on NewtonSDK#flushEvents
    Parameters:
    Name Type Argument Description
    err Error <optional>
    If something was wrong
    Source: