WinJS Toolkit – JavaScript Toolkit for Windows 8


WinJS Toolkit – JavaScript Toolkit for Windows 8


The WinJS Toolkit (#WinJSTK) is a set of classes and helper functions that help creating Windows Store applications in HTML5, CSS3 and JavaScript. The WinJS Toolkit also contains templates that you can add to Visual Studio to simplify creating new items in your solution.


Windows 8 : ARM vs INTEL

Windows 8 : ARM vs INTEL

I used to think that Win 8 Intel is the full version and Win- RT on ARM is the subset, but its not that simple:


Yes, any PC—including the i5 I’m using here for comparative purposes—can of course run Windows 8. But to take advantage of certain modern niceties—such as the smart phone-like Connected Standby power management mode—you need an ARM-based system running Windows RT or an Intel SoC system, which currently includes only the low-end Clover Trail Atoms. (Future high-end Intel chipsets will support this as well.)

Put another way, you’re forced to choose between the raw power of a traditional (Intel i3/i5/i7) PC and the finesse and elegance, if you will, of an ARM or Intel SoC-based device. In my own use of Surface RT,



Windows RT

Windows RT:

 Windows Store apps can use the Windows Runtime, a native API built into the operating system. This API is implemented in C++ and supported in JavaScript, C#, Visual Basic, and C++ in a way that feels natural for each language. ( )

ARM-based Windows RT devices, such as the Surface tablet, will require Metro apps. Devices running Windows 8 are expected to be able to run both Metro apps and Win32 apps.

Windows RT is an edition of the Windows 8 operating system designed for mobile devices that use 32-bit ARM architecture (ARMv7).[2] Microsoft intended for devices with Windows RT to take advantage of the architecture’s power efficiency to allow for longer battery life, to use system-on-chip (SoC) designs to allow for thinner devices, and to provide a “reliable” experience over time. In comparison to other mobile operating systems.

Windows RT also supports a relatively large number of existing USB peripherals and accessories, and includes a version of Microsoft Office 2013 optimized for ARM devices as pre-loaded software. However, while Windows RT inherits the appearance and functionality of Windows 8, it contains a number of limitations, which includes being incompatible with software designed for conventional versions of Windows, and lacking certain features.

First unveiled as a prototype in January 2011 at Consumer Electronics Show, the operating system was officially launched alongside Windows 8 on October 26, 2012, with the release of three Windows RT-based tablets—one of which being Microsoft’s own Surface tablet. Unlike most other versions of Windows, Windows RT is only available as pre-loaded software on devices specifically designed for the operating system by OEMs. Windows RT was released to mixed reviews from various outlets and critics. Some felt that Windows RT devices had advantages over other mobile platforms (such as iOS or Android) because of its bundled software and the ability to use a wider variety of USB peripherals and accessories. However, concerns were raised surrounding software compatibility limitations, whether ARM devices still had battery life advantages over their x86-based counterparts, and Microsoft’s poor marketing practices. As a result of these shortcomings, the first five Windows RT devices were met with poor sales, leading OEMs to step away from the platform, and critics to question the long-term viability of Windows RT.


Windows RT

The “RT” stands for “runtime”, for the Windows Runtime Library, the programming model for applications in the Metro design language. This is an intermediate level software library that allows developers to write an application once and be able to compile it in different ways, so that it runs on both Intel-type and ARM processors. This allows software programs and applications that are built using the WinRT APIs to be distributed for use on the 32-bit and 64-bit x86 Intel-based devices, like your office PC, as well as ARM devices like Windows Phone.


One of the three editions of the forthcoming Windows 8 (along with Windows 8 standard and Windows 8 Pro), Windows RT is a tablet-focused operating system designed to run on mobile devices powered by ARM-based chips. While Windows RT has been developed for use on tablets and similar mobile devices, it isn’t designed for smartphones, which will instead utilize the forthcoming Windows Phone 8 mobile operating system.

The “RT” in Windows RT stands for runtime, and unlike the other two versions of Windows 8, Windows RT (also called WinRT and Windows on ARM) is anOEM-only edition that won’t be available for purchase in stores. In addition to running on ARM-powered tablets, low-cost notebooks and other mobile devices from a variety of OEMs, Windows RT will also power Microsoft’s own tablet device, the Microsoft Surface Tablet.

Windows RT (for “Runtime”) is a version of Microsoft‘s Windows 8 operating system (OS) designed for mobile devices, particularly tablet PCs. Windows RT should not be confused with WinRT, the Windows Runtime library that provides system services for Metro apps

Windows RT  was originally called Windows on ARM (WOA) because it is meant to run onARM processors. The operating system has been likened to a tablet version of Windows Phone because it features a similar tile-based UI (user interface). The OS will come pre-installed on hardware, not as a stand-alone product. The first installations of RT will be on the lower-end version of Microsoft’s Surface tablet; the higher end version of the device runs a full implementation of Windows 8.

Microsoft has published a specification set that devices will need in order to run Windows RT properly. Requirements include:

  • A touch screen with at least 1366 x 768 pixel resolution.
  • At least 10 GB of internal storage.
  • Built-in camera with an ambient light sensor, an accelerometer, a gyroscope and a magnetometer.
  • At least one USB (Universal Serial Bus) 2.0 port.
  • Wi-Fi and Bluetooth 4.0 connectivity.
  • Controls common to most tablets such as a power switch, volume adjustments, and rotation lock/unlock.

Windows RT will ship with core versions of the most popular apps familiar to Windowsusers. The system will not run third-party applications unless they conform to the Windows RT standard, are approved by Microsoft and are offered in the Windows Store. Devices equipped with Windows RT will be “locked down” in the sense that users will not be able to uninstall Windows RT and replace it with any other OS.


What are the differences between Windows 8 on a tablet and Windows RT?

Brien Posey: With Windows RT, it’s running on an ARM processor, so it can’t run the old school, non-Metro Windows apps, whereas Windows 8 on a tablet can. Another difference is that Windows RT comes with Microsoft Office built in — that’s Office 2013 — whereas a regular Windows 8 tablet [doesn’t]. Even the Microsoft Surface Pro doesn’t come with it. One other difference is that a Windows RT tablet can’t be domain joined, whereas a Windows 8 tablet can.




Windows Runtime, or WinRT, is a platform-homogeneous application architecture on the Windows 8 operating system. WinRT supports development in C++/CX (Component Extensions, a language based on C++) and the managed languages C# and VB.NET, as well as JavaScript and TypeScript. WinRT applications natively support both the x86 and ARM architectures, and also run inside a sandboxed environment to allow for greater security and stability.[1][2]

WinRT is essentially a COM-based API, although relying on an enhanced COM. Due to its COM-like basis, WinRT allows interfacing from multiple languages, just as COM does, but it’s essentially an unmanaged, native API. The API definitions are, however, stored in “.winmd” files, which are encoded in ECMA 335 metadata format, the same format that .NET uses with a few modifications.[3] This common metadata format allows for significantly less overhead when invoking WinRT from .NET applications compared to P/Invoke, and much simpler syntax.[4] The new C++/CX (Component Extensions) language, which borrows some C++/CLI syntax, allows the authoring and consumption of WinRT components with less glue visible to the programmer compared to classic COM programming in C++, and at the same time imposes fewer restrictions compared to C++/CLI on the mixing of types. Regular C++ (with COM-specific discipline) can also be used to program with WinRT components,[5] with the help of the new Windows Runtime C++ Template Library (WRL), which is similar in purpose to what Active Template Library provides for COM.[6]

Applications developed using WinRT for Windows 8 and RT are known as Windows Store apps. During the development of Windows 8, they were referred to as Metro-style apps; a term tying them in with a design language of the same name used heavily throughout the operating system. However, the term began to be phased out in August 2012—while reports stated that Microsoft warned developers to stop using the term due to trademark issues with a company of a similar name, a spokesperson claimed that “Metro” was only a codename and that an official name was to be unveiled.[7] The terms Windows 8 style and Modern UI style were also used interchangeably by Microsoft employees and documents to refer to the new app platform prior to the launch of Windows 8.[8][9][10]

WinRT components are designed with an eye to interoperability between multiple languages and APIs, including native, managed and scripting. For example the Component Extensions of C++/CX are recommended to be used only at the API-boundary, not for other purposes.[12]

WinRT applications will run within a sandbox. Examination of the runtime libraries reveals that they are built upon Win32 API.[13] This is the same approach as used by .NET.

Because it is CLI metadata the programmer can then use code written in native WinRT-languages (C++) from managed CLI languages.

WinRT components[edit]

Classes that are compiled to target the WinRT are called WinRT components. They are classes that can be written in any supported language and for any supported platform. The key is the metadata. This metadata makes it possible to interface with the component from any other WinRT language. The runtime requires WinRT components that are built with .NET Framework to use the defined interface types or .NET type interfaces, which automatically map to the first named. Inheritance is as yet not supported in managed WinRT components, except for XAML classes.[15]

Programming interfaces[edit]

Programs and libraries targeted for the WinRT runtime can be created and consumed from a number of platforms and programming languages. Notably C/C++ (either with language extensions offering first-class support for WinRT concepts, or with a lower-level template library allowing to write code in standard C++), .NET (C# and VB.NET) and JavaScript. This is made possible by the metadata.

In WinRT terminology, a language binding is referred to as a language projection.

WinRT is a native platform and supports any native C++ code. A C++ developer can reuse existing native C/C++ libraries with the only need to use the language extensions when writing code that is interfacing with the runtime.


See also: .NET Framework

The .NET Framework and the Common Language Runtime (CLR) are integrated into the WinRT as a subplatform. It also has influenced and set the standards for the ecosystem through the metadata format and libraries. The CLR provides services like JIT-compilation code andgarbage collection. WinRT applications using .NET languages use the new Windows Runtime XAML Framework, and are primarily written in C#VB.NET, and for the first time for XAML, with native code using C++/CX. Although not yet officially supported, programs can also be written in other .NET languages.

Classes defined in WinRT components that are built in managed .NET languages must be declared as sealed, so they cannot be derived from. However, non-sealed WinRT classes defined elsewhere can be inherited from in .NET, their virtual methods overridden, and so on (but the inherited managed class must still be sealed).

Members that interface with another language must have a signature with WinRT types or a managed type that is convertible to these.[15]


See also: JavaScript and Rich Internet Application

WinRT applications can also be coded using HTML with JavaScript in code-behind, which are run using the Trident rendering engine and Chakra JavaScript engine, both of which are also used by Internet Explorer. When coding a WinRT app in JavaScript, its features are adapted to follow JavaScript naming conventions, and namespaces are also mapped to JavaScript objects.


WinRT comes with an Application Programming Interface (API) in the form of a class library that exposes the features of Windows 8 for the developer, like its immersive interface API. It is accessible and consumable from any supported language.

Windows classes[edit]

The Windows classes are native C/C++ libraries (unmanaged) that are exposed by the WinRT. They provide access to all functionality from the XAML parser to the camera function.

Naming conventions[edit]

The naming conventions for the components (classes and other members) in the API are heavily influenced by the .NET naming conventions which uses camel case (specifically PascalCase). Microsoft recommends users to follow these rules in case where no others are given.

These conventions are projected differently in some languages, like JavaScript, which converts it to its conventions and the other way around. This is to give a native and consistent experience regardless of the programming language.

Restrictions and rules[edit]

Since Windows Runtime is projected to various languages, some restrictions on fundamental data types exist in order to host all of these languages. Programmers have to be careful with the behavior of those types when used with public access (for method parameters, method return values, properties, etc.).[21]

  • Basic Types
    • In .NET languages and C++, there is a rich set of data types representing various numerals.
    • In JavaScript, a Number can only represent up to 53 bits of precision.
    • In WinRT, the only lacking numeral data type is 8-bit signed integer when compared to .NET and C++. JavaScript developers have to pay attention when dealing with big numbers while coding against WinRT.
  • Strings
    • The strings in .NET and JavaScript are immutable, whereas they are mutable in C++.
    • A null pointer passed as a string to WinRT by C++ will be converted to an empty string
    • In .Net null being passed as a string to WinRT will be converted to an empty string
    • In JavaScript null being passed as a string to WinRT will be converted to a string with the word “null”. This is due to JavaScript’s null keyword being represented as a null object
    • Similar results happen when passing undefined to WinRT from JavaScript
      • Structs
        • In .NET and C++, structs are value types, and such a struct can contain any type in it.
        • JavaScript does not directly support structs.
        • In WinRT, usage of structs is only allowed for containment of types that has value semantics, including numerals, strings, and other structs. No pointers or interface references are allowed.
  • References
    • In .NET, objects are passed by reference, whereas numerals and structs are passed by value.
    • In C++, all types can be passed by reference or by value.
    • In WinRT, interfaces are passed by reference; all other types are passed by value.
  • Arrays
    • In .NET, C++, and JavaScript arrays are reference types.
    • In WinRT, arrays are value types.
  • Events
    • In .NET and C++, clients subscribe to events using += operator.
    • In JavaScript, addEventListener function or setting on<EventName> property is used to subscribe to events.
    • In WinRT, all languages are allowed to use their own way of subscribing to events.
  • Collections
    • Various .NET collections map directly to WinRT collections.
    • WinRT Vector type resembles arrays and the array syntax is used to consume them.
    • WinRT Map type is a key/value pair collection, and is projected as Dictionary in .NET languages.
  • Method Overloading
    • All WinRT languages feature overloading on parameters (.NET, C++, JavaScript)
    • .NET and C++ also feature overloading on type.
    • In WinRT, only parameter number is used for overloading.
  • Asynchrony
    • All WinRT methods are designed such that any method taking longer than 50 milliseconds is an async method.
    • There is an established naming pattern to distinguish asynchronous methods: <Verb>[<Noun>]Async. Through the entire runtime library, all methods that have chance to take longer than 50 ms are only implemented as asynchronous methods.

Windows Phone Runtime[edit]

Windows Phone 8 has limited support for development and consuming of Windows Runtime components through Windows Phone Runtime. Many of the Windows Runtime APIs in Windows 8 that handle core operating-system functionality have been ported to Windows Phone 8.[22] Support for development of native games using C++/CX and DirectX has been added by request from the game development industry.

The Windows Phone XAML Framework is however still based on the same Silverlight framework as in Windows Phone 7 for backwards compatibility. XAML development is therefore not currently possible in C++/CX. Development using either HTML5 or WinJS is unsupported on Windows Phone 8 at the moment.



Windows Phone 8 uses a version of the Windows Runtime known as the Windows Phone Runtime.[11] It enables app development in C#, VB.NET and development of Windows Runtime components in C++/CX.



WinRT is a set of modern, object-oriented APIs introduced in Windows 8. WinRT is built on top of Win32 and COM and is designed to provide interoperability for the various languages using metadata. In addition to the previously available Windows and .NET APIs, now exposed in a cleaner, streamlined way, WinRT provides an access to all the new features of Windows 8.

Some WinRT APIs are closely coupled with the new Windows Store app model while others can safely be used for desktop application development. For Windows desktop applications, using the WinRT APIs enables simple ways to access GPS and NFC devices, the accelerometer, orientation, light, and other sensors. Moreover, some WinRT classes are only available for desktop apps, like PackageManager.

Accessing WinRT APIs from desktop applications is a supported process and the documentation on how to do it is light.


WinRT is full of asynchronous calls. Lovell told us that Microsoft had seen in the past that if both synchronous and asynchronous APIs are available for the same function, then developers often use the synchronous version even when they should not, making applications less responsive. The new await keyword in C# makes this easy to code.

WinRT makes use of the ILDasm metadata format which is also used by .NET. This means you get rich metadata for IntelliSense and debugging, but note that the actual runtime is not .NET; they just borrowed the same metadata format.

WinRT objects are reference counted like COM for memory management, with weak references to avoid circularity. You should not have to worry about this; you can code according to the conventions of your language.

There are three ways to write WinRT applications. One is C++, in which case you write directly to the “projection” of WinRT into your language. The second is .NET, in which case your code goes via the CLR. The third is HTML and JavaScript, in which case your code goes via the “Chakra” JavaScript engine also used by Internet Explorer 9 and higher. Lovell assured me that there is little difference in performance in most cases, though there could be advantages for C++ in certain niche scenarios. Of course we heard that story for .NET as well, but from what I have seen it is more plausible in WinRT.

There is no message loop in WinRT. There is no GDI in WinRT. All graphics are via DirectX. XNA, the .NET games framework, is not supported. It seems that you will need to use C++ for fancy DirectX coding, though this is not confirmed. Of course your XAML or Canvas code will be rendered by DirectX under the covers.

It is fascinating to see how Microsoft has borrowed XAML and ILDasm from .NET, but that WinRT is native and not .NET at its core. My take on this is that Microsoft intended to preserve the productivity of .NET, but without any performance compromise.

Despite the inclusion of .NET though, the fact that only a subset of the Framework is available, and that interop to the Windows API will not work*, means that most existing apps will need considerable work to be ported to Metro.


Using winRT OR COM ? :



Windows 8

In particular, these changes included a touch-optimized Windows shell based on Microsoft’s “Metro” design language, the Start screen (which displays programs and dynamically updated content on a grid of tiles), a new platform for developing apps with an emphasis on touchscreen input, integration with online services (including the ability to sync apps and settings between devices), and Windows Store, an online store for downloading and purchasing new software. Windows 8 added support for USB 3.0Advanced Format hard drives, near field communications, and cloud computing.


Building Windows 8″ blog:

Windows Store apps

Windows 8 introduces a new style of application, Windows Store apps. According to Microsoft developer Jensen Harris, these apps are to be optimized for touchscreen environments and will be more specialized than current desktop applications. Apps can run either in a full-screen mode, or be snapped to the side of a screen.[83] Apps can provide toast notifications on screen or animate their tiles on the Start screen with dynamic content. Apps can use “contracts”; a collection of hooks to provide common functionality that can integrate with other apps, including search and sharing.[83] Apps can also provide integration with other services; for example, the People app can connect to a variety of different social networks and services (such as Facebook, Skype, and People service), while the Photos app can aggregate photos from services such as Facebook and Flickr.[79]

Windows Store apps run within a new set of APIs known as Windows Runtime, which supports programming languages such as CC++Visual Basic .NETC#, along with HTML5 and JavaScript.[83] If written in some “high-level” languages, apps written for Windows Runtime can be compatible with both Intel and ARM versions of Windows,[84] otherwise they are not binary code compatible. Components may be compiled as Windows Runtime Components, permitting consumption by all compatible languages.[85] To ensure stability and security, apps run within a sandboxed environment, and require permissions to access certain functionality, such as accessing the Internet or a camera.[86]

Retail versions of Windows 8 will be able to install these apps only through Windows Store—a namesake distribution platform which offers both apps, and listings for desktop programs certified for comparability with Windows 8.[84][86]

.NET for Windows Store apps APIs

The .NET for Windows Store apps provide a set of managed types that you can use to create Windows Store apps for Windows using C# or Visual Basic. The following list displays the namespaces in the .NET for Windows Store apps. Note that the .NET for Windows Store apps include a subset of the types provided in the full .NET Framework for each namespace. For information about individual namespaces, see the linked topics.

For more information, see .NET for Windows Store apps overview.

Windows Store apps only: APIs for Windows Store apps that are expressed as HTML or XAML elements are supported only in Windows Store apps; they are not supported in desktop apps or Windows desktop browsers.



Metro UI

Metro apps are touch-screen-friendly apps written especially for Microsoft’s WinRTprogramming interfaces.

ARM-based Windows RT devices, such as the Surface tablet, will require Metro apps. Devices running Windows 8 are expected to be able to run both Metro apps and Win32 apps.

Metro apps, which will be sold in an online store much like the Apple app and AndroidGoogle Play stores, are expected to sell for $1.49 and up. The name Metro, which is the name of a design language originally conceived for mobile Internet devices (MID) andsmartphones, may not be associated with the apps when they come to market. Microsoft has said that the name “Metro” may remain an internal code name used by developers. It is not yet clear what the customer-facing name for Windows RT apps will be.