Centralized inter-starlet messaging. Main methods are ask/tell, others are curried aliases for specific actions.
Members
-
<static, readonly> registered :Boolean
-
Whether Starlet has registered itself with Connection.
Type:
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.
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
-
<static> nav(starlet)
-
Navigate framework to a specific Starlet.
Parameters:
Name Type Description starlet
String Framework name of Starlet to navigate to.
-
<static> navRelay(starlet, command, options)
-
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.
-
<static> register() → {Boolean}
-
Registers Starlet with Connection.
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.
-
<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.
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.).
Returns:
true
- Type
- Boolean
Example
Bus.tell('usergroups', { 'action': 'create', 'name' : 'Foo', 'users' : [1, 2, 3] });
-
<static> unregister() → {Boolean}
-
Unregisters Starlet with Connection.
Returns:
true
- Type
- Boolean