Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
KNOCKOUTJS BLUEPRINTS

You're reading from   KNOCKOUTJS BLUEPRINTS Learn how to design and create amazing web applications using KnockoutJS

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781783980840
Length 218 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Carlo Russo Carlo Russo
Author Profile Icon Carlo Russo
Carlo Russo
Arrow right icon
View More author details
Toc

Modularizing with the component binding handler

In this section, we are going to discuss two different concepts:

  • AMD and RequireJS
  • KnockoutJS binding handler called component

The reason we are going to look at them together is because the best way to use the second one is with the help of the first one.

AMD and RequireJS

Asynchronous Module Definition (AMD) is a way to modularize JavaScript; you can get a good overview of what AMD is and why it is a good idea to use it at this URL: http://requirejs.org/docs/whyamd.html.

Before the use of AMD, all HTML pages were full of script tags to import all the scripts used. You have seen this behavior in the previous chapter, when we put five script tags into each HTML page.

One of the goals of AMD is to improve the separation of JavaScript and HTML; we get this because we put only one script tag in the HTML file, representing the main entrance to our client-side application. Inside this entrance file we put all the logic to load the other components, with...

You have been reading a chapter from
KNOCKOUTJS BLUEPRINTS
Published in: Feb 2015
Publisher:
ISBN-13: 9781783980840
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image