Class: AppService

AppService


new AppService()

The class representing dapp service.

Source:

Members


MessageType :number

Message type to send or receive.

Type:
  • number
Properties:
Name Type Default Description
INTERNAL number 1

The internal message

IN_RETURN number 2

The internal return message.

EXTERNAL_LAUNCHER number 3

The external launcher message

EXTERNAL_INSTALL number 4

The external install message

EX_RETURN number 5

The external return message.

Source:

Methods


close(onSuccess [, onError])

Close the dapp.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

Source:

getAppInfo(onSuccess [, onError])

Get a dapp info.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success, the param is a AppInfo.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

Source:

getLocale(onSuccess)

Get locale.

Parameters:
Name Type Description
onSuccess function

The function to call.the param include 'defaultLang', 'currentLang' and 'systemLang'.

Source:

launcher(onSuccess [, onError])

Start the launcher.If the launcher running, it will be swith to curent.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

Source:

sendMessage(id, type, msg, onSuccess [, onError])

Send a message by id.

Parameters:
Name Type Argument Description
id string

The dapp id.

type MessageType

The message type.

msg string

The message content.

onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

Source:

setListener(callback)

Set listener for message callback.

Parameters:
Name Type Description
callback onReceiveMessage

The function receive the message.

Source:

start(id, onSuccess [, onError])

Start a dapp by id. If the dapp running, it will be swith to curent.

Parameters:
Name Type Argument Description
id string

The dapp id.

onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

Source: