Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm just gonna post this as a mean to share a code ideas, but no real plans to replace our current implementation.
Many checks for the correct
_STAGEare missing as well as old documentation inevent.luanot being updated, but I've loaded with some maps and it works just like previous, sinceevent.luaacts as a backwards compatibility layer exposing all the old methods.Miscellaneous of ideas:
1a. It could be possible to remove
event.luaand only useevent_core.lua(maybe renaming it toevent.lua) by having the event module register its tables to the storage table & tokenizing the handlers passed to it itself, removing the dependency ofglobal.luaandtoken.lua`.1b. Moving small bits of logic to the event module may make it completely independent but it kinda breaks the single-responsibility principle, which I'm not too happy to do either.
2a. It could be simplified to always call
Event.add(...)' around the code base and it'll automatically take care of registering whatever handler (function, token, string) it has been passed to it, with/without theon_tick_option`.2b. On the other hand, keeping
event.lualayer to add specific methods to call for on_tick/tokens/whatever could be easier to read/use? May be subjective.event.luacould still take care of input sanitization and stage checks whileevent_core.luaonly handles the technical part of adding/removing