Producing dependencies

This section shows you how a module can produce a dependency. When a module self-executing function is evaluated, it can return an object what the module is itself. Modify your previous example to return a value:

(function ($) {
  // Do something with jQuery
  return {hello:"world"}

In this example, a simple JavaScript object is returned and stored by the dependency system of AMD and also provided as arguments of modules which want to consume the foo module.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus