What is the preferred way to enqueue just a function in scriptaculous?
I have an application, that uses scriptaculous' effects queue to render the view of a game. Ajax-requests read events from a server, from these events, effect开发者_JS百科s are generated and enqueued.
Some events have nothing to animate, only code to execute. It is possible, by creating a Dummy-effect, and use the afterFinish option.
Is there a better way?
Yes, You can write your own effect class and take advantage of all kinds of Scriptaculous/Prototype goodness.
Here is an example I wrote.
There seems to be an undocumented Effect-class which is basically my dummy class: Effect.Event(options), which is used internally by scriptaculous. For my purpose (just enqueueing a function) it does the Job.
精彩评论