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 packetString Name of OrionObjects.DataPacket being requested.
metaObject Criteria and information about the request. Besides the properties defined below, each packet type expects varying additional criteria.
Properties
Name Type Argument Description actionString <optional>
Action to be performed immediately (e.g. 'list', 'get', etc.).
subscribeBoolean <optional>
Whether to receive future updates.
callbackfunction <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.nameString 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 encryptBoolean true - encrypt; false - decrypt
dataString if encrypting, the string to encrypt; if decrypting, the base64 string to decrypt
saltString encryption salt
-
<static> nav(starlet)
-
Navigate framework to a specific Starlet.
Parameters:
Name Type Description starletString 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 starletString Framework name of Starlet to navigate to and send command.
commandString Name of command being sent.
optionsObject 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 starletString Framework name of Starlet to send command.
commandString Name of command being sent.
optionsObject Index of additional values to send.
-
<static> reload(nocache) → {Boolean}
-
Reloads Starlet's WebView.
Parameters:
Name Type Argument Default Description nocacheBoolean <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 packetString Name of OrionObjects.DataPacket being requested.
metaObject Criteria and information about the request. Besides action, each packet type expects varying additional criteria.
Properties
Name Type Argument Description actionString <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