简体   繁体   English

在另一个规则集中引发事件

[英]Raising an event in another ruleset

I'm collaborating on a large Kynetx app with another developer. 我正在与另一个开发人员合作开发大型Kynetx应用程序。 To make it easier to split up the work, I'd like to have multiple rulesets so we can work on them separately without stepping on each other's toes. 为了简化工作分配,我想拥有多个规则集,以便我们可以分别处理它们而又不会踩到对方的脚趾。

Is there a way to raise an event (explicit or otherwise) in another ruleset? 有没有办法在另一个规则集中引发事件(显式或其他)? Something like this in a postlude: 在后记中是这样的:

raise explicit event next_section in a163x50

I know it's possible to do with JavaScript in the browser, but I'd like to do this from the KRL on the server side. 我知道可以在浏览器中使用JavaScript,但是我想从服务器端的KRL进行此操作。

You can raise events in the postlude, and you use with [appid] instead of in. Check out the Explicit Events section of the Postlude Documentation . 您可以在Postlude中引发事件,并与[appid]一起使用,而不是与in一起使用。请查看Postlude文档的Explicit Events部分。

Here is an example postlude, raising an event to a new app with some context: 这是一个示例postlude,它在某种情况下将事件引发到新应用程序:

fired {
  raise explicit event "something" for a163x50 with cheese = "swiss";
}

For a really complete walkthrough of loosely coupled rulesets, see Phil Windley's post called Tweeting from KBlog . 有关松散耦合规则集的真正完整介绍,请参阅KBlog的 Phil Windley的帖子Tweeting

Don't forget about modules for code reuse. 不要忘记用于代码重用的模块。 Wrapping functionality in a module makes it much easier to test that code, and enable use within multiple rulesets. 模块中的包装功能使测试该代码更加容易,并允许在多个规则集中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM