Class: FlowScriptCompiler

flowScriptCompiler~FlowScriptCompiler()

Compiles Scripts built using the Conversation Flow Language. Violet registers widgets (similar to an HTML tag) here which then allows the scripts to be loaded (converted to a document) and then compiled (registering intents with the ConversationEngine). This class is implemented as a set of static methods.

Constructor

new FlowScriptCompiler()

Source:

Methods

(static) compile()

Compiles the CFL script using the FlowScriptDoc provided by the Load method.
Source:

(static) load()

Loads a CFL script. This is used when loading an app or for widget builders wanting to accept CFL as a parameter (see violetList as an example).
Source:

(static) registerWidget(widgetDef)

Registers a Conversational Element (Widget) to be used in a FlowScript. This method is intended to be called by Widget Implementations when loaded.
Parameters:
Name Type Description
widgetDef Object widget definition
Properties
Name Type Description
name String name of the widget, i.e. what the element name is going to be in the CFL for this widget.
init String initiatilizes the widget for every element in the CFL document. This parameter method is used rarely (only by *app*, *decision* and *dialog* widgets) so that the code is called at compile time once for every node and intents/hooks are registered using the *registeringIntentHooks* method. This callback is called with three parameters: a reference to the CFL Doc, a reference to Violet (the conversation engine), and a reference to the widget node.
fIntentType Boolean used to flag if the widget type needs to be associated with a intent/hook when the *registeringIntentHooks* method is called. It is currently used by the *choice* adn *dialog* widgets.
impl Object implementation for the widget. This is called at runtime when the widget gets triggered. Most widgets need to provide an implementation for this. The typical example is the *say* widget. This callback is called with three parameters: a reference to the runtime response object, a reference to the CFL Doc, and a reference to the widget node
fNonNestable Boolean used to flag widgets that are not to be processed by the FlowScriptCompiler. These are used when non-CFL elements are nested inside the given widget, for example with the *say* element which can include SSML tags.
Source:

(static) resolveElementChildrenForOutlet(response, flowScriptDoc, elNode)

Calls the implementation (resolve method) of children elements.
Parameters:
Name Type Description
response Object the runtime response object
flowScriptDoc Object the CFL Doc
elNode Object the widget node
Source:
Documentation generated by JSDoc 3.5.5 on Sat Mar 14 2020 19:55:45 GMT-0400 (EDT)