Add a control as a child.
The control is appended to the end of the this.children
array.
Control
the container
Determines if a child control can handle the request.
From the candidates that report canHandle = true
, a winner is selected
by this.decideHandlingChild(candidates)
.
The selected "winner" is recorded in this.selectedHandlingChild
.
Input
Determines if a child control can take the initiative.
From the candidates that report canTakeInitiative = true
, a winner is selected
by this.decideInitiativeChild(candidates)
.
The selected "winner" is recorded in this.selectedInitiativeChild
.
Input
Decides a winner from the canHandle candidates.
The candidates should be all the child controls for which
canHandle(input) = true
Default logic:
this.children
array.Remarks:
The child controls that reported canHandle = true
Input
Decide a winner from the canTakeInitiative candidates.
The eligible candidates are child controls for which
canTakeInitiative(input) = true
.
Default logic:
this.children
array.The child controls that reported canTakeInitiative = true
Input
Evaluate an APL document/data source prop.
act
The input object
Constant or function producing a map of key:value pairs
Evaluate a boolean prop.
Constant or function producing boolean
The input object
Evaluate a prompt prop.
act
Constant or function producing String or List-of-Strings
Input object
Calls canHandle on each child control to determine the candidates for delegation.
Input
Calls canTakeInitiative on each child control to determine the candidates for delegation.
Input
Gets the Control's state as an object that is serializable.
Only durable state should be included and the object should be
serializable with a straightforward application of
JSON.stringify(object)
.
Default: {return this.state;}
Usage:
.state
variable
and only store simple data.Framework behavior:
JSON.stringify
.control.setSerializableState(serializedState)
.Serializable object defining the state of the Control
Delegates handling of the request to the child control selected during canHandleByChild.
Input
Response builder.
Determines if the Control's value is ready for use by other parts of the skill.
Note:
isReady === !canTakeInitiative
because isReady
implies
that no further discussion is required and thus there is no need to take the
initiative.Input object.
true
if the control has no further questions to ask the user such as
elicitation, clarification or confirmation.
Add response APL component by this control.
This is intended to be used to provide APL rendering component for a control to process inputs, provide feedback, elicitation etc through touch events on APL screens.
Input
Response builder
Add response content for a system act produced by this control.
This is intended to be used with the default ControlManager.render() which implements a simple concatenation strategy to form a complete response from multiple result items.
System act
Input
Response builder
Sets the state from a serialized state object.
Default: {this.state = serializedState;}
Usage:
Framework behavior:
Serializable object defining the state of the Control
Delegates initiative generation to the child control selected during canHandleByChild.
Input
Response builder.
Merges the user-provided props with the default props.
Any property defined by the user-provided data overrides the defaults.
A control that uses and manages child controls.
Default logic of
decideHandlingChild()
&decideInitiativeChild()
:Choose the most-recent initiative control if is a candidate.
Otherwise, choose the first candidate in the positional order of the
this.children
array.In the special case of
input = FallbackIntent
, only the most-recent initiative control is considered. If it is not a candidate, then no child is selected.Usage:
Container controls can and should add high-level behaviors and respond to high-level requests such as multi-valued intents.
Container controls should forward simple inputs to the child controls whenever possible in order to share the load and achieve scalable logic.
Container controls should explicitly decide which child will handle an input or take the initiative in situations where there are multiple children that respond
canHandle = true
orcanTakeInitiative = true
.