小编mrp*_*rpx的帖子

使用Dojo框架调度自定义事件

我正在使用Dojo框架来帮助我在Javascript开发中使用交叉浏览DOM操作和事件管理.
为此,我希望在对象之间使用自定义事件调度.但我没有发现任何相关内容.我读到了订阅/发布,但这不完全是我想要的.
这是我想要做的:

var myObject = new CustomObject();
dojo.connect(myObject, 'onCustomEvent', function(argument) {
    console.log('custom event fired with argument : ' + argument);
});


var CustomObject = (function() {
    CustomObject = function() {
        // Something which should look like this
        dojo.dispatch(this, 'onCustomEvent', argument);
    };
}) ();
Run Code Online (Sandbox Code Playgroud)

有人可以帮帮我吗?

谢谢.

javascript events dojo

6
推荐指数
1
解决办法
2706
查看次数

标签 统计

dojo ×1

events ×1

javascript ×1