#cp.rx.go.Statement
A Statement
is defined to enable processing of asynchronous resolvable
values such as cp.rx.Observable values.
To define a new Statement
, you call the named constructor, assigning the result to a constant value and calling the define method.
#Definine a new Statement
To define a new Statement
implementation, we use the Statement.named constructor. This gives us a Statement.Definition which allows us to set the rules for the statement before finally "defining" it.
Statements may have an onInit
, and must have an onObservable
provided, and then the define
method must be called.
For example, the First statement is defined like so:
Once you've defined a statement, you then execute it by calling the statement directly, passing in any parameters.
For example:
This will output:
The Observable
as passed to the onInit
function handler as the second parameter. context
is always the first parameter, followed by any values passed to the constructor call.
The onObservable
function handler is called once the statement is actually executing, typically by calling the Now or After methods.
It is recommended that any conversion of input parameters are converted to
Observable
s as late as possible, typically in theonObservable
function handler. Otherwise, input values may get resolved before the user intends.
#Submodules
#API Overview
Functions - API calls offered directly by the extension
Constructors - API calls which return an object, typically one that offers API methods
Methods - API calls which can only be made on an object returned by a constructor