I鈥檝e now seen, and given, multiple talks comparing Angular 2 code on the web and in NativeScript. In those talks, often the only difference between the web and native code was the use of localStorage
on the web, and the application settings module in NativeScript.
We should create a new localStorage
module that shims the underlying application settings code鈥攎uch like we do with XMLHttpRequest
and the http module.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
This also helps close the gap on reusable web code, much of which uses local storage. I shim it in virtually all my projects by aliasing it off the global object....
https://github.com/burkeholland/nativescript-todo-angular/blob/master/app/main.ts
I like the idea for the same reasons you both have mentioned. The idea of prototyping an app on the web using Angular2 and then possibly being able to reuse some/most of that code in NativeScript is an attractive idea. In reality,
@burkeholland
Maybe you could add it as a PR for {N}? I'd love to have it too, in our project.
I know this is old, but for those who like me are here from a Google search. This project works. :-)
Most helpful comment
This also helps close the gap on reusable web code, much of which uses local storage. I shim it in virtually all my projects by aliasing it off the global object....
https://github.com/burkeholland/nativescript-todo-angular/blob/master/app/main.ts