Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying MASTERING KNOCKOUTJS
  • Table Of Contents Toc
MASTERING KNOCKOUTJS

MASTERING KNOCKOUTJS

By : Moran
4.7 (6)
close
close
MASTERING KNOCKOUTJS

MASTERING KNOCKOUTJS

4.7 (6)
By: Moran

Overview of this book

If you are an experienced JavaScript developer who is looking for new tools to build web applications and get an understanding of core elements and applications, this is the book for you. A basic knowledge of DOM, JavaScript, and KnockoutJS is assumed.
Table of Contents (11 chapters)
close
close
10
Index

Sticking to MVVM


Knockout was designed with the Model-View-ViewModel (MVVM) pattern in mind. While it is possible to develop applications using Knockout and other design patterns, sticking to MVVM will produce a natural alignment between Knockout and your own code.

The view and the viewmodel

The separation of concerns is the key here. Don't introduce view concepts such as DOM elements or CSS classes into your viewmodel; these belong in the HTML. Limit or avoid business logic and inline binding functions in your view; these belong as properties or functions in your viewmodel. Keeping these two separated makes it possible for the work to be divided and parallelized, allows the viewmodel to be reusable, and makes it possible to unit test the viewmodel.

Cluttering the viewmodel

Animation handlers are a good example of view logic that often ends up in the viewmodel. The foreach binding handler has several postprocessing hooks (such as afteradd, afterrender, and beforeremove) that are intended to...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
MASTERING KNOCKOUTJS
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon