JS EventDispatcher suggestion

Hi,

I’m not sure how difficult this would be, but it would be nice if the JS event dispatcher worked more like the Lua side dispatcher (https://docs.coronalabs.com/api/library/system/newEventDispatcher.html).

I’m working with a plugin that dispatches a number of events and having only one listener option ends up requiring a lot of if/elseif statements.

The Lua dispatcher uses the “name” property as a key that can be listened for, allowing different listeners to be set up.

thing.addEventListener('init', onInit)

otherthing.dispatchEvent({name='init', data={ loaded = true }})

Can something similar be done with the JS dispatcher?

-dev

I guess not so difficult … added in TODO list

Hi,

Playing around with the AWS SDK and looking through some of the FB Instant Games documentation, I think an update to the eventDispatcher is going to be crucial.

-dev

implemented… attached a sample 

Hi,

@vitaly1 You’re awesome!

-dev

I guess not so difficult … added in TODO list

Hi,

Playing around with the AWS SDK and looking through some of the FB Instant Games documentation, I think an update to the eventDispatcher is going to be crucial.

-dev

implemented… attached a sample 

Hi,

@vitaly1 You’re awesome!

-dev