libraries

overview


The $libraries method is an optional method that is used to tell the platform what libraries that the component requires in order to run. It returns a list of URL's of the libraries required. When the component is loaded for the first time, any libraries that it specifies will be loaded prior to the component being instantiated.



this.$libraries = function () {		
  return ['/lib/lib1.js','/lib/lib2.js'];
}
					


When it is required to load one library prior to loading others, due to dependencies, the libraries can be specified as an object with a url property, and a dependency property.



this.$libraries = function () {		
  return [
    {
      url: '/lib/lib1.js'
    },
    {
      url: '/lib/lib2.js',
      dependencies: ['/lib/lib1.js']
    },
    { url: '/lib/lib3.js' },
  ];
}