Namespace: Bus

Bus

Centralized inter-starlet messaging. Main methods are ask/tell, others are curried aliases for specific actions.

Source:

Members

<static, readonly> registered :Boolean

Whether Starlet has registered itself with Connection.

Type:
Source:

Methods

<static> ask(packet, meta) → {Object}

Request data with criteria, or send a data-related instruction expecting a result. Data on demand (action), future updates (subscribe), or both can be acquired via this single method.

Parameters:
Name Type Description
packet String

Name of OrionObjects.DataPacket being requested.

meta Object

Criteria and information about the request. Besides the properties defined below, each packet type expects varying additional criteria.

Properties
Name Type Argument Description
action String <optional>

Action to be performed immediately (e.g. 'list', 'get', etc.).

subscribe Boolean <optional>

Whether to receive future updates.

callback function <optional>

Function to respond to incoming data. May also be associated via the promise's then method, though it will only resolve once. Remember to specify the context of the callback or include a closure so it can access its controller.

Source:
See:
Returns:

promise

Type
Object
Examples
Bus.ask('users',
{
  'action'   : 'list',
  'subscribe': true,
  'callback' : controller.onUserData.bind(controller)
});
      
Bus.ask('users', {'action': 'list'}).then(controller.onUserData.bind(controller));

<static> console() → {Boolean}

Open developer console for a Starlet.

Parameters:
Name Type Description
[starlet=Starlet.name String

Framework name of Starlet to open developer console for.

Source:
Returns:

true

Type
Boolean

<static> crypto(encrypt, data, salt)

Encrypts or decrypts data passed into it.

Parameters:
Name Type Description
encrypt Boolean

true - encrypt; false - decrypt

data String

if encrypting, the string to encrypt; if decrypting, the base64 string to decrypt

salt String

encryption salt

Source:

Navigate framework to a specific Starlet.

Parameters:
Name Type Description
starlet String

Framework name of Starlet to navigate to.

Source:

Navigates to another Starlet while sending it a command. Target Starlet must have the corresponding case defined.

Parameters:
Name Type Description
starlet String

Framework name of Starlet to navigate to and send command.

command String

Name of command being sent.

options Object

Index of additional values to send.

Source:

<static> register() → {Boolean}

Registers Starlet with Connection.

Source:
Returns:

true

Type
Boolean

<static> relay(starlet, command, options)

Sends a command to another Starlet, which must have the corresponding case defined.

Parameters:
Name Type Description
starlet String

Framework name of Starlet to send command.

command String

Name of command being sent.

options Object

Index of additional values to send.

Source:

<static> reload(nocache) → {Boolean}

Reloads Starlet's WebView.

Parameters:
Name Type Argument Default Description
nocache Boolean <optional>
true

Whether Starlet's WebView should be reloaded from server.

Source:
Returns:

true

Type
Boolean

<static> tell(packet, meta) → {Boolean}

Send a data-related instruction, expecting no result.

Parameters:
Name Type Description
packet String

Name of OrionObjects.DataPacket being requested.

meta Object

Criteria and information about the request. Besides action, each packet type expects varying additional criteria.

Properties
Name Type Argument Description
action String <optional>

Action to be performed (e.g. 'list', 'get', etc.).

Source:
See:
Returns:

true

Type
Boolean
Example
Bus.tell('usergroups',
{
  'action': 'create',
  'name'  : 'Foo',
  'users' : [1, 2, 3]
});

<static> unregister() → {Boolean}

Unregisters Starlet with Connection.

Source:
Returns:

true

Type
Boolean