javascript - How to use eve() in Raphael? - Stack Overflow

Can some one give me a simple example of Raphael eve()?I don't quite understand the parameters and

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.

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.

Share Improve this question edited Feb 9, 2012 at 13:56 stema 93.2k20 gold badges110 silver badges137 bronze badges asked Jan 27, 2012 at 10:28 tomentomen 5399 silver badges21 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

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);

http://jsperf./eve-js-versus-events

Use Event.js. I think it is better. Not just faster. But understand the key conceptual difference. eve.js works without a DOM. Event.js is basicaly DOM events library. Although not 100%.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745212050a4616900.html

相关推荐

  • javascript - How to use eve() in Raphael? - Stack Overflow

    Can some one give me a simple example of Raphael eve()?I don't quite understand the parameters and

    5小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信