Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Dependencies #73

Open
shadowtime2000 opened this issue Nov 21, 2020 · 1 comment
Open

Global Dependencies #73

shadowtime2000 opened this issue Nov 21, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@shadowtime2000
Copy link
Contributor

Currently there is no way to have global dependencies that are only initialized once. I think we should have a deps.js file which has some global dependencies. It could be like this:

const dbORM = require("db-orm");

const connection = dbOrm("my-connection");

module.exports = {
  connection
};

So then only one connection is created which is reused through out the different widgets.

@peterthehan peterthehan added the enhancement New feature or request label Nov 21, 2020
@shadowtime2000
Copy link
Contributor Author

We would still have to figure out how exactly using those dependencies should work. How about, if the event handler is an object, use deps as a list of dependencies that match to names of keys in deps.js and create an object from that, and inject that into the creator value of that object, and use the output as the event handler. If it is a function, just use it. We would probably have to do some forwarding of the dependencies to the command handlers in the command widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants