Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Note unsupported


Warning
titleEngine Compatibility
emit is not supported by the Node engine.

emit <javascript>

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

The value following 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.

Code Block
languagejavascript
themeConfluencelanguagejavascript
emit << 
	console.log('Hello world');
>>;

The following ruleset shows emit() being used

Code Block
languagejavascript
themeConfluencelanguagejavascript
ruleset a1299x168 {
	meta {
		name "emit example"
		author "nathan cerny"
		logging off
	}
	dispatch {
		// domain "exampley.com"
	}

	rule emit_example {
		select when pageview ".*" setting ()
        {
	        emit <<
                $K('h1').append('Hello World');
            >>;
        }
	}
}

...