Classes
Methods
(static) getEnvironmentString() → {String}
Get the environment string representation
Returns:
- Type
- String
(static) getSharedInstance() → {Newton}
Get the shared instance
Throws:
-
- Throw if getSharedInstanceWithConfig hasn't been called
- Type
- Error
Returns:
- Type
- Newton
(static) getSharedInstanceWithConfig() → {Newton}
Get the shared instance. Create one if no sharedInstance found
Throws:
-
- Throw if no secret is given
- Type
- Error
Returns:
- Type
- Newton
(static) getVersionString() → {String}
Get current Newton version
Returns:
- Type
- String
__temporaryUserDelete(userDeleteCallback)
Delete the current user.
Parameters:
Name | Type | Description |
---|---|---|
userDeleteCallback |
UserDeleteCallback | The callback invoked when the request is done. It has an error if the request couldn't be completed |
finalizeLoginFlow(callback)
Finalize login flow
Used only for customized waiting page
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | invoked at the end of the flow. An error is given to discern the error case |
flowBegin(name, customDataopt)
Begin a flow. Close a previous flow with a fail if need.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The name of the flow | |
customData |
Newton.SimpleObject |
<optional> |
Some data attached to this event |
flowCancel(name, customDataopt)
End a flow with a cancellation
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The reason of the cancellation | |
customData |
Newton.SimpleObject |
<optional> |
Some data |
Throws:
Throw if there's not a begun flow
flowFail(name, customDataopt)
End a flow with a failure
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The reason of the failure | |
customData |
Newton.SimpleObject |
<optional> |
Some data |
Throws:
Throw if there's not a begun flow
flowStep(name, customDataopt)
Make a step for a flow
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The name of the step | |
customData |
Newton.SimpleObject |
<optional> |
Some data attached to this event |
Throws:
Throw if there's not a begun flow
flowSucceed(nameopt, customDataopt)
End a flow with a success
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
String |
<optional> |
"ok" | A name that identify the end |
customData |
Newton.SimpleObject |
<optional> |
Some data |
Throws:
Throw if there's not a begun flow
flushEvents()
Force to flush all events - dummy method in javascript
Parameters:
Type | Description |
---|---|
callback | invoked asynchronously |
getLoginBuilder() → {LoginBuilder}
Return a login builder instance
Returns:
- Type
- LoginBuilder
getOAuthProviders() → {Array}
Return a list of available and supported oauth provider
Returns:
- the list
- Type
- Array
getUserMetaInfo(callback)
Retreive the user metainfo
Parameters:
Name | Type | Description |
---|---|---|
callback |
MetaInfoCallback |
getUserToken() → {String}
Return The user token.
Returns:
- The user token
- Type
- String
isAnalyticFlowBegun() → {Boolean}
Return true if a flow is begun (analytics)
Returns:
- true if there is a begun flow
- Type
- Boolean
isLoginFlowRunning() → {Boolean}
Return true is a login flow is running
Returns:
- true if a login flow is running
- Type
- Boolean
isUserLogged() → {Boolean}
Return true if Newton User is logged
Returns:
- true if Newton User is logged
- Type
- Boolean
sendEvent(name, customDataopt)
Queue a custom event
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The name of this event | |
customData |
Newton.SimpleObject |
<optional> |
Some data attached to this event |
Throws:
Will throw error if label is not valid or customData is a wrong type
setUserStateChangeListener(listener)
Notify the changing of the user status
Parameters:
Name | Type | Description |
---|---|---|
listener |
UserStateChangeListener |
syncUserState(syncStateCallback)
Refresh the current local user state asking to the server the real user state
Parameters:
Name | Type | Description |
---|---|---|
syncStateCallback |
SyncStateCallback | The callback invoked when the state is really refreshed |
timedEventStart(name, customDataopt)
Start a timed event
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The name of the timed event | |
customData |
Newton.SimpleObject |
<optional> |
Some data attached to this event |
timedEventStop(name, customDataopt)
Stop a timed event.
The event has a merge of this customData and the customData passed on timedEventStart method
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | The name of this event | |
customData |
Newton.SimpleObject |
<optional> |
Some data attached to this event |
Throws:
Throw if there's no started event the given name
userLogout()
Log the user out