The not-so-obvious part, however, is that by default, no Windows 10 Universal specific definitions are included or available for use by newly created projects. When working with Web Applications and Windows Universal 10 JS applications, lib.d.ts is available when writing TypeScript files so that things like window.localStorage are available.
When working with universal apps, however, we do not want to use window.localStorage, but instead Windows.Storage.ApplicationData.current.localStorage should be used. By default, however, this is not available to typescript files. You must install the definition from nuget or elsewhere.
PM> Install-Package winjs.typescript.definitelytyped
PM> Install-Package winrt.typescript.definitelytyped
These packages will provide definitions for storage and other native APIs that can be called from javascript.
Hopefully this will save someone else hours of searching! :)
No comments:
Post a Comment