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
I am failing on the third test in gulp. I guess i don't understand what Lines 33-35 are testing. It seems to me that we are calling inject on ModuleA with the the result of calling aFunc as the parameter. What is the point of doing this? I think that according to the specs, that if there are no further arguments provided in aFunc, it should just return the value of calling aFunc() back. Why does this seem to be more complicated than this?
The test is to see if we can "load multiple modules." Not sure why adding another module would cause the program to halt. Is it because I am using "this" improperly? It seems that they would be sequential calls. Maybe I am missing an async consideration.
Additionally, should we be using the regex in our register function to parse through the array of dependencies? Or in our inject function? Or both?
The text was updated successfully, but these errors were encountered:
@njt2116 All really good questions! For the first one, I'm assuming you mean lines 33-5 in lib/di/DI.spec.js. Assuming that's the case:
The point of calling inject with a function that uses aFunc as a parameter is to use the Dependency Injection system to find that function and return a new function that has the aFunc function passed in as an argument. If that sounds like a bit of circular logic, remember that when you use a dependency injection system, you can't just require in other files the way you do in node. Instead, you registered functions and then you use inject to make use of those functions in new functions that you want to create. Because of this, you don't want to simply return the value of call aFunc() since the inject function may want to use aFunc in a variety of ways. What you want to do is give the function that's being injected the ability to make use of aFunc any way it pleases, the same way that when you require in a file or module in node, you want to be able to use that required-in module in any way you please.
As for the "load multiple modules" test, can you make sure to push the latest version of your code so I can see what is going on in there and then send me an email so I can respond privately if necessary, since I really need to be able to see what you're doing right now in order to respond.
Finally, the register function should be extremely simple. It just takes in a name and a function and registers that function under that name in some kind of registeredFuncs object on the module that the register() function is called on. It is only in the inject() function that you need to parse through the array of registered function dependencies. Make sense?
I am failing on the third test in gulp. I guess i don't understand what Lines 33-35 are testing. It seems to me that we are calling inject on ModuleA with the the result of calling aFunc as the parameter. What is the point of doing this? I think that according to the specs, that if there are no further arguments provided in aFunc, it should just return the value of calling aFunc() back. Why does this seem to be more complicated than this?
The test is to see if we can "load multiple modules." Not sure why adding another module would cause the program to halt. Is it because I am using "this" improperly? It seems that they would be sequential calls. Maybe I am missing an async consideration.
Additionally, should we be using the regex in our register function to parse through the array of dependencies? Or in our inject function? Or both?
The text was updated successfully, but these errors were encountered: