-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] once handler #54
Comments
A lot of things and implementations were declined because that strict limit, so probably no. You might be interested in https://github.com/tunnckocore/dush, which is around ~300-400b, with all needed things, and can have micro plugins. I needed |
As reference for anyone looking for this functionality: It's possible to add a const emitter = mitt()
emitter.once = (type, handler) => {
const wrappedHandler = (evt) => {
handler(evt)
emitter.off(type, wrappedHandler)
}
emitter.on(type, wrappedHandler)
} |
@rangermeier this will not work when you try to unregister the handler via .off() before it was called at least "once". |
would u consider adding this or is it out of scope? Ive tried implementing it myself so I could send a PR, but my minifications skill are not that great ;)
best result i got was
214B
which is exceeding ur goalThe text was updated successfully, but these errors were encountered: