-
Notifications
You must be signed in to change notification settings - Fork 25
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
provide simple example of addDependency #8
Comments
Hi Amergin, You are correct. The ability to use DI is one of the most important Br,
|
Hi Amergin, I have attempted to recreate your issue with the following code:
That code gave me the console output:
Granted I was using ng-lodash. Which is a lodash angular adaptation. It is still possible that the angular-workers implementation contain a bug relating to this. But I would need your help in finding that bug. |
What I'm trying to say here is that a method to include libraries that are not Angular-dependent would be nice. A library that would be passed as-is to Personally I don't feel there's much point in touching ng-lodash when lodash.js is the more actively developed and does not need interacting with Angular. And that is just one example, |
I also agree with @amergin. |
OK, this is not so much a bug as a feature request. Including external scripts in the worker code can be done currently by using the importScripts method call. That is what is used to load angular external dependencies in the web worker. But to make external scripts, not written as angular modules injectable in the worker is something that I consider to be beyond the scope of angular-workers (To the best of my knowledge this can not be directly done in angular running in the main thread). Either use importScripts and import it directly in the worker code, or create a angularjs service wapper script that wraps and exports the desired feature from the external library. That service can then be injected into the worker. The dependency injection in the angular-worker library is intended to emulate the behavior of angular in the main thread as closely as possible. Adding the ability to inject external scripts extends the existing functionality of angular, which is not the goal of the library. |
Ok, I managed to edit the library, so now it takes 3 arguments, and the second one is an array of functions that we would like to use inside of blob. If you are interested in the solution, please tell. |
How is one supposed to use
addDependency
to include external libraries? Consider this example:lodash
into my WWaddDependency
and expect it to be injected:This later results in an DI error when calling
createAngularWorker
. What am I doing wrong? I consider adding external libraries one of the most important feature since they allow me to include relevant math and utility libraries.The text was updated successfully, but these errors were encountered: