Created
          June 20, 2011 16:11 
        
      - 
      
- 
        Save snay2/1035904 to your computer and use it in GitHub Desktop. 
    Bug with raising events in called rulesets
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ruleset a163x111 { | |
| meta { | |
| name "Raise event test" | |
| description << | |
| Original rule. Events can be raised to this rule from itself or from 112. | |
| Run at http://ktest.heroku.com/a163x111 | |
| >> | |
| author "Steve Nay" | |
| logging off | |
| } | |
| dispatch {} | |
| global {} | |
| rule notifya { | |
| select when pageview ".*" setting () | |
| { | |
| notify("Hello World", "FIRST rule. <a href='javascript:raise111_this()'>Raise event in this rule</a>") with sticky=true; | |
| emit <| | |
| raise111_this = function() { | |
| KOBJ.get_application("a163x111").raise_event("testevent"); | |
| }; | |
| |>; | |
| } | |
| fired { | |
| raise explicit event show for a163x112; | |
| } | |
| } | |
| rule notifyb { | |
| select when pageview ".*" setting () | |
| { | |
| notify("Hello World", "FIRST rule. <a href='javascript:raise111_other()'>Raise event in SECOND rule</a>") with sticky=true; | |
| emit <| | |
| raise111_other = function() { | |
| KOBJ.get_application("a163x112").raise_event("testevent"); | |
| }; | |
| |>; | |
| } | |
| } | |
| rule responder { | |
| select when web testevent | |
| { | |
| notify("Event", "This was raised (111)") with sticky=true; | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ruleset a163x112 { | |
| meta { | |
| name "Raise event test 2" | |
| description << | |
| Second rule. Events can be raised to the original rule, but not this one. | |
| >> | |
| author "Steve Nay" | |
| logging off | |
| } | |
| dispatch {} | |
| global {} | |
| rule notifya { | |
| select when explicit show | |
| { | |
| notify("Hello World", "SECOND rule. <a href='javascript:raise112_other()'>Raise event in FIRST rule</a>") with sticky=true; | |
| emit <| | |
| raise112_other = function() { | |
| KOBJ.get_application("a163x111").raise_event("testevent"); | |
| }; | |
| |>; | |
| } | |
| } | |
| rule notifyb { | |
| select when explicit show | |
| { | |
| notify("Hello World", "SECOND rule. <a href='javascript:raise112_this()'>Raise event in this rule</a>") with sticky=true; | |
| emit <| | |
| raise112_this = function() { | |
| KOBJ.get_application("a163x112").raise_event("testevent"); | |
| }; | |
| |>; | |
| } | |
| } | |
| rule responder { | |
| select when web testevent | |
| { | |
| notify("Event", "This was raised (112)") with sticky=true; | |
| } | |
| } | |
| // Rule allowing just this ruleset to be run at http://ktest.heroku.com/a163x112 | |
| rule just_this { | |
| select when web pageview ".*" | |
| noop(); | |
| fired { | |
| raise explicit event "show"; | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment