Class: NewtonSDK

NewtonSDK

NewtonSDK

<private> new NewtonSDK()

NewtonSDK
Source:

Methods

finalizeLoginFlow()

Finalize login flow Used only for customized waiting page
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

getOAuthProviders() → {Array}

Return a list of available and supported oauth provider
Source:
Returns:
the list
Type
Array

getUserToken() → {String}

Return The user token. This is not the user Id
Source:
Returns:
- The user token
Type
String

isUserLogged() → {Boolean}

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

isUserLoggedAsync(callback)

Make sure the knowledge about login user state
Parameters:
Name Type Description
callback NewtonSDK~isUserLoggedAsyncCallback
Source:

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:

setLoginCallback()

Invoked on login complete successfully or not.
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

userLogout()

Log the user out
Source:

Type Definitions

flushEventsCallback(err)

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

isUserLoggedAsyncCallback(err, isLogged)

This callback is used on NewtonSDK#isUserLoggedAsyncCallback
Parameters:
Name Type Argument Description
err Error <optional>
If something was wrong
isLogged Boolean <optional>
If the user is logged
Source: