Windows Store App Development Series : Part 10–Execution Context

Hello,

Lets explore the execution context of Windows Store App. Execution context is an environment in which an app runs. As you’re now aware that Windows Store App can be developed using different technologies like C#, VB, C++ and JavaScript, their execution contexts differs.

In addition it is important to understand how Windows Store App developed using JavaScript executes differently than traditional web application and what are the differences in their execution contexts.

Web Context

A traditional web application developed using HTML, JS and CSS executes in a web context. That means web application normally gets deployed using a web server, for example IIS. Client apps then sends requests to the web server, which is responsible for processing these requests in asynchronous manner and sends response to the clients.  However there are certain known limitations of executing code in web context. For example, JavaScript application code executes in web context -

    1. Cannot access native file system. That means application can not read or write file on user’s computer. 
    2. Cannot access printers, webcam, scanners. Your application needs to depend on 3rd party products to get access to these peripherals.
    3. Cannot access Windows API

Windows Store App Context / Local Context

Windows Store App developed using HTML, JS and CSS runs in a local context. That means application code written using JavaScript can access native file system, Windows API, device features like webcam, sensors etc. Microsoft made it possible by introducing Windows Runtime [WinRT] API component which acts as a bridge between Windows Store App and Windows runtime. Using WinRT API application can access user profile information, external devices like camera, printers, can connect to other services hosted on internet, access Windows 8 charms, tiles etc..

 

Local Context

As a web developer, you might want to load useful JavaScript libraries like jQuery, KnockoutJs etc dynamically and use it within Windows Store App, however its not possible to load external JavaScript files dynamically. Since Windows Store app runs in local context, you need to explicitly add these files to the application before executing it.

WWAHost.EXE

WWAHost process which hosts Windows Store App developed using JS in local context. It has JavaScript based execution engine and HTML based rendering engine similar to Internet Explorer 10. It communicates to Windows Runtime to get access to native file system, external peripherals etc.

To view WWAHost.exe in action, run JS based Windows Store App. Go to ‘Details’ tab in Windows Task Manager.

WWAHost 

Summary

In this article, I have explained difference between execution contexts of traditional web application and Windows Store app developed using JavaScript. Hope it was helpful.

Thanks for reading.

P.S – Local context image extracted from channel 9.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>