daveyang / eventdispatcher Goto Github PK
View Code? Open in Web Editor NEWProvides custom event broadcaster/listener mechanism to regular Lua objects.
Home Page: http://swfoo.com/?p=632
Provides custom event broadcaster/listener mechanism to regular Lua objects.
Home Page: http://swfoo.com/?p=632
Hi,
Not sure if it's possible, but it would be nice to be able to pass the event name as a string in both emit and dispatchEvent.
dispatcher:emit( "MyEvent", ... )
Perhaps there is some underlying reason why that isn't possible, but I always get tripped up on that one. It could be because on and addEventListener are like that. :)
If not, no big deal. Thanks for the module.
Cheers.
Hi Dave,
It would be great to have EventDispatcher in the Luarocks ecosystem.
https://github.com/keplerproject/luarocks/wiki/Creating-a-rock
Cheers.
Hello,
First off, thank you again for EventDispatcher, it's one of my favorite modules. I was just going to put in a feature request for you to consider. On Coronium GS there is an event method called once, which basically clears/removes the event listener after one run.
object:once( "SomeEvent", function( event )
print( "do something once" )
end)
And secondly, an removeAllListeners method, which could take an event as an optional search key.
obj1:on( "Event", onEvent1 )
obj2:on( "Event", onEvent2 )
--Clear all "Event" listeners
EvtD:removeAllListeners( "Event" )
--Clear ALL listeners
EvtD:removeAllListeners()
Not sure if you'd be interested in either of those, but wanted to pass it along. Thanks again.
Cheers,
Chris @coroniumgs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.