Afforess / Factorio-Stdlib

Factorio Standard Library Project
ISC License
162 stars 45 forks source link

Event - revise effect of 'register' with nil handler #128

Closed Kovus closed 5 years ago

Kovus commented 6 years ago

I'm requesting that Event.register(event, handler) be revised to generate an error upon a nil handler, and that a new function be created to remove all handlers associated with a particular event.

At one time, I thought it was a decent idea to be able to remove the events associated with a particular event. It even seems like something that would be useful to do.

After twice spending more than a short while trying to understand why my event handler isn't working (and in one case, why none of the event handlers associated with an event were firing), I found that both cases were due to me having a typo in Event.register(...).

Nexela commented 6 years ago

These issues are handled in the event re write in the data-library branch I do believe

On Thu, Jul 5, 2018, 5:07 PM Kovus notifications@github.com wrote:

I'm requesting that Event.register(event, handler) be revised to generate an error upon a nil handler, and that a new function be created to remove all handlers associated with a particular event.

At one time, I thought it was a decent idea to be able to remove the events associated with a particular event. It even seems like something that would be useful to do.

After twice spending more than a short while trying to understand why my event handler isn't working (and in one case, why none of the event handlers associated with an event were firing), I found that both cases were due to me having a typo in Event.register(...).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Afforess/Factorio-Stdlib/issues/128, or mute the thread https://github.com/notifications/unsubscribe-auth/ANUy4CcRgrE4WAXhy59angCHyuzLpwjQks5uDoAmgaJpZM4VEixJ .