2

I've been writing some pseudo-oop JavaScript using the Module pattern. I'm curious, what is the best way to handle dependencies on libraries in my JavaScript modules?

For example, if my module makes use of the jQuery or Underscore libraries, is there a way I should be passing in a reference to those, or should I just use them assuming that they will have what they need from the other scripts passed into the page?

1 Answer 1

2

It's best if you pass them in as a reference. It's kinda like importing a library:

(function(JQuery) {
...
})(jQuery);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.