February 2015
Intermediate to advanced
232 pages
4h 40m
English
To convert our modules into RequireJS-compatible modules, we will define them using the AMD specification. This specification says that to define a module you need to call the define function. This function receives an array that contains strings. These strings represent paths or aliases from the configuration file for each dependency (files required in the module).
The second parameter that the define function needs is a function that will return the module. This function will have dependencies from the array as arguments. The good thing with this pattern is that code inside the define function will not be executed until all dependencies are loaded. The following is what the define function will look like:
define(['dependency1','dependendency2'],function(dependency1,depencency2){ ...Read now
Unlock full access