11
Windows 8 Programming with HTML and JavaScript Chad McCallum ASP.NET/IIS MVP iQmetrix Software http://www.rtigger.com @ChadEmm / [email protected]

Windows 8 programming with html and java script

  • Upload
    rtigger

  • View
    2.017

  • Download
    1

Embed Size (px)

DESCRIPTION

A few slides to get people familiar with Windows 8 applications in JavaScript - WinJS, app lifecycle, app container, and more

Citation preview

Page 1: Windows 8 programming with html and java script

Windows 8 Programming with HTML and JavaScript

Chad McCallumASP.NET/IIS MVP

iQmetrix Softwarehttp://www.rtigger.com

@ChadEmm / [email protected]

Page 2: Windows 8 programming with html and java script

Windows RT API

Windows Runtime is implemented at a low-level and then “projected” into C++, C#, VB, and JavaScript APIs

Allows the APIs to present the same functionality in a way that’s familiar to developers of that language

Page 3: Windows 8 programming with html and java script

Native App in HTML?

Apps are run in an Internet Explorer 10 shell

This means:Can include other JS librariesHTML5 and CSS3 support for user interfaceCan do (almost) anything you’d do with a web

application

Page 4: Windows 8 programming with html and java script

What are these apps called?

Windows Store appsAcquired, installed, and updated via the

Windows Store appPackaged into an “.appx” file when submittedContains a manifest file that describes the app,

the resources it uses (camera, network, etc.), and lists OS integrations (background tasks, file associations, etc.)

Page 5: Windows 8 programming with html and java script

Windows Library for JavaScriptaka WinJSWrapper for Windows Runtime APIProvides:

Access to system-level resourcesHTML implementation of WinRT controls,

complete with CSS styling and eventsCSS3-based animation frameworkHelpers for common coding patterns

Page 6: Windows 8 programming with html and java script

Not Quite a Web Page

Some DOM API calls are modified or unavailable, like alert or window.open

There are some methods, properties, and CSS queries that are specific to a Windows Store app

Allowed to make cross-domain requests, load resources from remote sources

Page 7: Windows 8 programming with html and java script

Not Quite a Web Page

Not allowed to reference scripts remotely

IFrames are run in “web context” without access to WinRT

Some DOM-based calls are modified or removed (document.write, innerHTML)

Page 8: Windows 8 programming with html and java script

App Container

Run within a dedicated environment that can’t access other applications and the system directly

Have unrestricted read/write access to their own appdata folders

Access to any other files or hardware goes through a broker, which can deny access

Page 9: Windows 8 programming with html and java script

App Lifecycle4-ish states

Starting: shows splash screen image, does all the app initialization behind the scenes

Running: active application on user’s device Suspending: app has lost focus, 5 seconds to save

state Resuming: app has regained focus

Suspended: still in memory, but not allocated any CPU time

Terminated: removed from memory, effectively closed. OS triggers this at will, app is not informed

Page 10: Windows 8 programming with html and java script

App StateWhen being “suspended”, Windows 8 gives your

app approximately 5 seconds to save its state

Can save data as Temp, Local, and RoamingSave as a file and/or key-value pairsAlways app-specific, as they’re saved relative to

your app’s directoryRoaming settings are uploaded to user’s Microsoft

Account and are accessible across devices

Page 11: Windows 8 programming with html and java script

Code Time!


<!doctype html><html><head><script type=