I am studying the John Papa Multiple Selection Course at the SPA.
In his main.js he gave a name to every js library that is included in the kit.
(function () { var root = this; define3rdPartyModules(); function define3rdPartyModules() { // These are already loaded via bundles. // We define them and put them in the root object. define('jquery', [], function () { return root.jQuery; }); define('ko', [], function () { return root.ko; }); define('amplify', [], function () { return root.amplify; }); define('infuser', [], function () { return root.infuser; }); define('moment', [], function () { return root.moment; }); define('sammy', [], function () { return root.Sammy; }); define('toastr', [], function () { return root.toastr; }); define('underscore', [], function () { return root._; }); } })();
But what is root here?
Thus, we can name these short names in the define statement:
define('vm.session', ['ko', 'datacontext', 'config', 'router', 'messenger', 'sort'], function (ko, datacontext, config, router, messenger, sort) {
Current, I do not know how to do this. So my working define statement is ugly:
define('vm.admin.outfitters', ['/Scripts/lib/jquery-1.8.1.js', '/Scripts/lib/jsrender.js', ...], function(){...
I know it's better to be better. All these js files are already included in the script package. How can I reference these scripts?