带有 SwfSuspenders 和 AS3Signals 的 Robotlegs

发布于 2024-08-29 03:13:34 字数 482 浏览 2 评论 0原文

有点困惑我的 XML 配置文件在什么时候会如何改变 切换到信号。 现在我使用的 3 个框架命令定义如下。 ViewChangedCommand 和 InitViewCommand 都映射到自定义 事件。

<type name='app.controller::StartupCommand'> 
    <field name='dataService'/> 
</type> 
<type name='app.controller::ViewChangedCommand'> 
    <field name='event'/> 
    <field name='model'/> 
</type> 
<type name='app.controller::InitViewCommand'> 
    <field name='model'/> 
</type> 

a bit confused as to how my XML config file would change when
switching over to Signals.
Right now the 3 framework Commands I am using are defined as follows.
Both ViewChangedCommand and the InitViewCommand are mapped to custom
events.

<type name='app.controller::StartupCommand'> 
    <field name='dataService'/> 
</type> 
<type name='app.controller::ViewChangedCommand'> 
    <field name='event'/> 
    <field name='model'/> 
</type> 
<type name='app.controller::InitViewCommand'> 
    <field name='model'/> 
</type> 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£冰雨忧蓝° 2024-09-05 03:13:34

无法确定 XML 配置,但以下是如何在代码中执行此操作:

您必须使用 SignalContext 而不是普通的 Context。这可以使用这个库来完成:

http://github.com/joelhooks/ Signals-extensions-CommandSignal/tree/48575b214da452e8c78d9eb2897bd018b1deaf3a

在上下文中,注入信号的单例,就好像它是模型的一部分一样,如下所示:

injector.mapSingleton(DataLoadSignal);

然后将信号映射到命令,如下所示:

signalCommandMap.mapSignalClass(DataLoadSignal, DataLoadCommand, false);

对于 xml配置,我想你只需要注入信号,其余的应该相当简单。

can't say for sure about the XML config, but here's how to do it in code:

you have to use a SignalContext instead of the normal Context. This can be done using this library :

http://github.com/joelhooks/signals-extensions-CommandSignal/tree/48575b214da452e8c78d9eb2897bd018b1deaf3a

in the context, inject a singleton of the Signal, as if it was part of the model, like so :

injector.mapSingleton(DataLoadSignal);

then map the signal to a command, like so :

signalCommandMap.mapSignalClass(DataLoadSignal, DataLoadCommand, false);

for the xml config, I guess you only have to inject the signal, and the rest should be fairly easy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文