Defining the app.js file

When we defined the RequireJS configuration, we said that the entry point will be the app.js file. The following are the steps to create the app.js file:

  1. Create the app.js file.
  2. Set the array of dependencies. Map these dependencies as arguments in the function. There are some files that just execute code and they return an undefined value. You don't need to map these files if they are at the end of the list of dependencies.
    define([ //LIBRARIES 'bootstrap', 'knockout', 'koAmdHelpers', 'ko.validation', 'icheck', //VIEWMODEL 'viewmodel', //MOCKS 'mocks/product', 'mocks/order', //COMPONENTS 'custom/components', //BINDINGS 'custom/koBindings', //EVENTS 'events/cart' ], function(bs, ko, koValidation, koAmdHelpers, 'iCheck', 'ViewModel) ...

Get KnockoutJS Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.