Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MikeGrace/546178 to your computer and use it in GitHub Desktop.
Save MikeGrace/546178 to your computer and use it in GitHub Desktop.
Kynetx app that raises event in JavaScript and also shows how to pass data back to the Kynetx server
ruleset a60x301 {
meta {
name "js raise event pass data"
description <<
js raise event pass data
>>
author "Mike Grace"
logging on
}
dispatch {
domain "example.com"
}
rule first_rule is active {
select when pageview ".*"
{
notify("App Ran","The app has run and now to raise an event via JavaScript") with sticky = true;
emit <<
var app = KOBJ.get_application("a60x301");
app.raise_event("shazam");
app.raise_event("mustafa", {"datum":"here is the datum 383409"});
>>;
}
}
rule first_rule is active {
select when web shazam
{
notify("JS raised event","simple with no data") with sticky = true;
}
}
rule data_passed_js_raised_event is active {
select when web mustafa
pre {
testy = page:env("datum");
}
{
notify("JS raised event with data",testy) with sticky = true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment