Writing code using the Windows Library for JavaScript (HTML)

Applies to Windows and Windows Phone

Purpose

Windows Library for JavaScript has a number of helper functions that you can use to define and extend JavaScript types. When you want to define new types or derive one type from another, you can use the functions in WinJS.Class. When you want to define different scopes for your JavaScript elements, you can use the functions in WinJS.Namespace.

You can also use mixins when you want to add functionality to your types. In JavaScript, mixins are types that are not instantiated and contain members that define a certain kind of behavior that can be added to multiple types. For example, a Movable mixin that contains functions goForward, goBackward, turnRight, and turnLeft can be be mixed into a number of different types, like Vehicle, Robot, and Animal. For more information about mixins, see Mixins.

In this section

TopicDescription

Quickstart: Scheduling tasks in a Windows Store app using JavaScript

The Scheduler allows your Windows Runtime app using JavaScript to perform background work without disrupting the app's foreground tasks (like animation). This helps minimize a seemingly unresponsive or 'stuttering' experience for users and can possibly shorten startup time.

Quickstart: Using the dispose model in WinJS

Learn how to use the dispose model in WinJS to reliably control the memory usage of controls and other objects in a Windows Store app using JavaScript.

Defining and deriving types with WinJS.Class (Windows Store apps using JavaScript and HTML)

You can use the WinJS.Class.define and WinJS.Class.derive functions to define and derive JavaScript types.

Organizing your code with WinJS.Namespace (Windows Store apps using JavaScript and HTML)

The WinJS.Namespace.define function allows you to create your own namespace as a way of organizing your code.

Adding functionality with WinJS mixins (Windows Store apps using JavaScript and HTML)

Mixins are objects that implement a certain class of functionality. For example, in the WinJS there are mixins that manage events and mixins that handle binding.

Event capture and event bubbling with DOM events (Windows Store apps using JavaScript and HTML)

In WinJS there are several addEventListener methods (for example, WinJS.Application.addEventListener and WinJS.UI.AppBar.addEventListener). They all contain a useCapture parameter, which is set to true if you want event capture or false if you want event bubbling. For more information, see Event capture and Event bubbling.

 

 

 

Show:
© 2014 Microsoft