You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was discussed that it would be neat if a module could expose an API to other modules.
For instance, say one module exposes link shortening capabilities to IRC users. It would be cool if it could expose a shortenLink() function to other modules, so they they could make their own messages more succinct.
Of course the bot would have to make sure that dependencies get resolved, and that modules are loaded in such a way that dependencies are available to eachother when needed. This is hard because currently moduleMan doesn't actually know when modules have finished loading. In addition, Dependency circles should probably be noticed.
Discussion of design and implementation of such a system should occur here.
The text was updated successfully, but these errors were encountered:
We can and I'm not sure. I've thought about a little. I was actually thinking about just hooking require for the modules and injecting all other modules as potential require-able things.
However good an idea that looks like, though, I don't think it's doable. "require" is synchronous and we need to be able to depend on modules across the network too which cannot be sync.
However, that's a tangent. We can, of course, drop dependencies in package.json.
My original intent, though, was for modules to export this stuff. The module might have "module.exports.dependencies = ['sirc-google']" or whatever and then the module simply won't be run if the dependency isn't loaded (and an error logged). Likewise, a "module.exports.predependency = ['sirc-database']" specifying module wouldn't be initted unless the database module was already initted.
It was discussed that it would be neat if a module could expose an API to other modules.
For instance, say one module exposes link shortening capabilities to IRC users. It would be cool if it could expose a shortenLink() function to other modules, so they they could make their own messages more succinct.
Of course the bot would have to make sure that dependencies get resolved, and that modules are loaded in such a way that dependencies are available to eachother when needed. This is hard because currently moduleMan doesn't actually know when modules have finished loading. In addition, Dependency circles should probably be noticed.
Discussion of design and implementation of such a system should occur here.
The text was updated successfully, but these errors were encountered: