Afforess / Factorio-Stdlib

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

Change Event.register to not accept nil handlers, add Event.remove_all. #129

Closed Kovus closed 6 years ago

Kovus commented 6 years ago

Implements #128.

This change makes it so that Event.register will no longer accept nil handlers. This prevents a typo from having the effects of 1) failing to register a handler, and 2) deregistering all associated handlers. I'm betting that most of the use of Event.register(...) is to actually register a handler, and not to unregister all of them.

In order to accomodate unregistering all handlers associated with an event, Event.remove_all(...) has been added.

Nexela commented 6 years ago

Handled in data_library (potential 1.0.0 release) by adding Event.remove functions.