如何在Raphael中使用eve()? [英] How to use eve() in Raphael?
本文介绍了如何在Raphael中使用eve()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
eve()
? 我不是了解参数和如何调用事件。
我正在搜索一下,但似乎没有太多人使用它。
解决方案
简单的例子Raphaël中的事件功能:
我们定义功能这将触发事件
功能栏()
{
var a,b;
a = 1;
b = 2;
eve(run-foo,self,a,b);
}
事件监听器功能
如果事件从bar()触发,则
// //这个= =self
// arg1 == a == 1
// arg2 == b == 2
// arg3 == undefined / null
}
eve.on(run-foo,foo);
Can some one give me a simple example of Raphael eve()
?
I don't quite understand the parameters and how to call events. I was searching around for a bit but seem like not so many people have used it.
解决方案
Simple example of the event functionality in Raphaël:
We define the function that will fire the event
function bar()
{
var a, b;
a = 1;
b = 2;
eve("run-foo", "self", a, b);
}
The event listener function
function foo(arg1, arg2, arg3)
{
// if the event is fired from bar() :
// this == "self"
// arg1 == a == 1
// arg2 == b == 2
// arg3 == undefined/null
}
eve.on("run-foo", foo);
这篇关于如何在Raphael中使用eve()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文