Manual Reference Source Test
import IdentityNative from 'src/modules/identity-native.js'
public class | source

IdentityNative

Extends:

Observable → IdentityNative

Identity native controller

Allows consumers to send and receive messages via a native application bridge. The native application must be set up to create a nativeWrapper window attribute to leverage the bridge calls.

Constructor Summary

Public Constructor
public

IdentityNative constructor

Member Summary

Public Members
public get

Return if bridge is initialized or not

Method Summary

Public Methods
public

Initialize the native controller

public

onMessage(message: Object)

Listen for messages from the native wrapper and add to the event bus

public

Initialize the native wrapper

public

sendCommand(subject: string, payload: Object)

Send a command to the native wrapper

public

Send a message to the native wrapper

public

subscribe(callback: function, type: string)

Add callbacks to the onMessage queue

public

Notify that the wrapper is ready

Inherited Summary

From class Observable
public

notify(type: string, data: *)

Notify all observers of specified event type

public

on(type: string, callback: Function): Function

Register callback to be called with events of specified type

Public Constructors

public constructor() source

IdentityNative constructor

Override:

Observable#constructor

Public Members

public get initialized: boolean: * source

Return if bridge is initialized or not

Return:

boolean

Public Methods

public init(): Promise source

Initialize the native controller

Return:

Promise

public onMessage(message: Object) source

Listen for messages from the native wrapper and add to the event bus

Params:

NameTypeAttributeDescription
message Object

public onWrapper(): Object source

Initialize the native wrapper

Return:

Object

public sendCommand(subject: string, payload: Object) source

Send a command to the native wrapper

Params:

NameTypeAttributeDescription
subject string
payload Object

public sendMessage(message: Object): Promise source

Send a message to the native wrapper

Params:

NameTypeAttributeDescription
message Object

Return:

Promise

public subscribe(callback: function, type: string) source

Add callbacks to the onMessage queue

Params:

NameTypeAttributeDescription
callback function
type string

public wrapperReady() source

Notify that the wrapper is ready