How to use eve() in Raphael?

前端 未结 2 854
被撕碎了的回忆
被撕碎了的回忆 2021-02-09 18:14

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 b

2条回答
  •  野的像风
    2021-02-09 18:38

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

提交回复
热议问题