This project is archived and is in readonly mode.

#520 ✓invalid


Reported by ikti | December 14th, 2008 @ 08:40 PM | in 2.0 (closed)

I have frequent need in my project to fire certain Event only once. Remembering handle an removing it once fired is really pain in the ass.

I suggest adding Event.addEventOnce or adding special suffix

Event.addEvent('clickOnce' ,func);

Event.addEventOnce is faster to write, but second approach is cleaner and faster to run

here is my code for addEventOnce

addEventOnce: function(type, fn)
	return this.addEvent(type, function()
		this.removeEvent(type, arguments.callee);

Comments and changes to this ticket

  • Valerio

    Valerio December 14th, 2008 @ 11:12 PM

    • State changed from “new” to “invalid”

    A special suffix in events for firing them only once is... curious. But no, thanks.

    As for your addEventOnce method: this is also why MooTools is so easily extensible, you can add every method you need so we dont have to.

  • ikti

    ikti December 15th, 2008 @ 08:52 AM

    Special suffix would also work in setOptions, my function does not.

    As for your comment: i think MooTools is so great, because You write most of the basic things, so I don't have to do it myself ;]

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket