botkalista / ayaya-league-external

External script platform for League of Legends
GNU General Public License v3.0
122 stars 36 forks source link

Don't dispatch undefined events #4

Closed myo closed 2 years ago

myo commented 2 years ago

forgot about onTick

botkalista commented 2 years ago

Actually for the cpu is better to dispatch an undefined event instead of placing a conditional (if in this case) so the cpu can precalculate the next operations. You can read more about this here https://dev.to/jobinrjohnson/branchless-programming-does-it-really-matter-20j4

myo commented 2 years ago

This is meant to make subscribing to events in userscripts optional, if you dispatch an event (call a function) that doesn't exist, node will complain about it not being a function.