Emit

From KynetxDocs

Jump to: navigation, search

Directly after the declaration block, KRL programs can contain a single, optional emit statement. Like so:

emit <value>

The value followingx the emit statement is put into the Javascript generated from the KRL program immediately after the variable declarations and before any actions. This allows Javascript to be inserted into the program to modify the values of any variables.

Here's an example of a emit statement that replaces all of the underscore characters (_) in the variable pagename with a space:

emit "pagename = pagename.replace(/_/g, ' ');"

Any value emitted from the KRL must be proper Javascript and must end with a semicolon.

Personal tools