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
Windows 8 Programming with HTML and JavaScript
Chad McCallumASP.NET/IIS MVP
iQmetrix Softwarehttp://www.rtigger.com
@ChadEmm / [email protected]
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
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
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.)
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
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
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)
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
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
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
Code Time!