-
Notifications
You must be signed in to change notification settings - Fork 376
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
load function doesn't return value... #194
Comments
That's how async works. |
The load is blocking call. So the caller is stopped until require(file)(this, cb) is done. |
That's true, my bad. I blindly assumed that since it uses a callback. |
Still, it's async. After the require, it will call the module and expect a callback to be invoked, which you could for example use to load things from the network, database, ... You can of course use it sync, I'm going to change it to return the returned value from the function so you can use it if you want, but that's entirely up to you to create that logic. |
File: ORM.js
Function: ORM.prototype.load
Issue:
Function load does not return any value when it is success. It is OK when model is loaded with instance of connect function. However, it has some problem using with express function.
In below code, novalue has undefined, because the load function doesn't return. It results in work-around code such as models.user = db.models.user;.
However, it'd be better that models.user = db.load ....
The text was updated successfully, but these errors were encountered: