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

Can't require an array of objects #168

Open
ofirdagan opened this issue Jun 6, 2016 · 2 comments
Open

Can't require an array of objects #168

ofirdagan opened this issue Jun 6, 2016 · 2 comments

Comments

@ofirdagan
Copy link

Hi, according to the docs page the require method can take either an object or an array of objects.

But I can't seem to use it with an array. I want to use it with array b/c I'm loading the names of the scripts dynamically and it will be easiest if I'll just send it as an array instead of requiring them one by one.

It seems like the trivial use case for multiple files. What am I missing?

Thanks!

@ray007
Copy link

ray007 commented Jun 7, 2016

Try basket.require.apply(basket, arrayVar);

@imrannaqvi
Copy link

imrannaqvi commented Jul 10, 2016

Not array of objects, but all objects one by one, only possible way is to use function.apply.
@ray007 You are absolutely right, this worked for me flawlessly.
basket.require.apply(basket, scripts).then(function () { //sucess }, function (error) { //error });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants