feat: Implement ctx.menu.at
#14
Labels
hacktoberfest
Good issue for hacktoberfest contributors :)
Projects
ctx.menu.at
#14
Allows to look up menu instances via the context object. They no longer have to be in scope.
This way, the menus can be defined in one file, and then imported and installed on the context object in the main file. They will be available in every other middleware in the code base.
This requires a new context flavour for menus, something that we were able to avoid thus far. However, given that it only really is necessary to be installed when that function is used, this should not be much of an issue.
The usage will be as follows.
Regarding performance, a menu instance lookup is going to take
O(n)
time withn
being the number of menu structures. Note that this number is equivalent to the number of menus passed tobot.use
calls.The text was updated successfully, but these errors were encountered: