Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added new example in previous version and minor fix in this version

...

Code Block
languagejs
titleCreating a Child then Running Code Inside the New Child
linenumberstrue
// Creates a new child with the "example" ruleset installed and passes an attribute named "testParam"
rule newExampleChild {
  select when example new_child
  always {
    raise wrangler event "child_creation" attributes {
      "rids":"testexample",
      "testParam":"hello"
    }
  }
}

// In the newly created child this rule will run
rule inNewChild {
  select when wrangler ruleset_added where rids >< meta:rid
  pre {
    paramFromParent = event:attr("testParam").klog("Should be 'hello'")
  }
  always {
    ent:initial_state := {} // Set a desired initial state of entity variables
  }
}

...