Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinJs in the browser?

After playing a bit with the new Visual Studio 11 preview, I think the most interesting question is how can I make my new javascript based app run also in the browser with minimal changes? is that possible? I suppose the idea of supporting javascript is for better cross-platform apps, am I right?

I understand some of the winJs code calls the WinRT, but can we use some of the WinJS code on web-based apps too?

like image 874
CD.. Avatar asked Sep 15 '11 21:09

CD..


5 Answers

I'm here at build and based on what the Microsoft guys have said is that WinJS does call into the Windows RT. Plus some of their stuff is based on some vendor prefix css stuff (ie IE10 only). So short answer is no, you can't.

More thoughts. To be clear, going from an existing Html/Js app to Win8 should just work. Some considerations of the Win8 App events, and the look and feel are some issues to be concerned about. But the core should work.

The original question is not to dissimilar than, "I have an IE9 HTML5/Js app that I want to run everywhere (including IE6, FF2), Is it possible?" There is a lot of functionality in their libraries, as well as there leveraging of new CSS3 features (-ms-grid, -ms-float, 3d transforms). As far as I know, all their gesture recognition stuff is in the winRT, for "fast and fluid" responsiveness, none of that you can really use outside the Metro environment.

In my opinion, the reason why win8 Metro-style apps is being supported, is not because of cross-platform apps, but to increase the developer base on who can write win8 apps.

like image 146
Andre Avatar answered Oct 16 '22 06:10

Andre


It seems like things have changed. WinJS has become available on all platforms... You can try it in the browser here: try.buildwinjs.com

WinJS is actually being open source now: blog, github

Use this powerful Windows development framework to build high-quality web apps across a variety of browsers and devices beyond Windows, including Chrome, Firefox, Android, and iOS.

like image 33
Sorskoot Avatar answered Oct 16 '22 07:10

Sorskoot


Yes, this is done in with lightswitch html components.

You can download and install lightswitch to see examples of using winjs cross browser. It uses promise objects etc.

like image 30
John Bowyer Avatar answered Oct 16 '22 06:10

John Bowyer


There is an alternative to winjs which should work in browsers: http://www.bluesky.io/ didn't tried it yet though.

like image 41
Tadeusz Wójcik Avatar answered Oct 16 '22 05:10

Tadeusz Wójcik


If you are writing games this would be possible, you can easily port them between a metro app and a web app without having to change a letter of code. This is because you don't really make use of the WinJS library.

For web apps I wouldn't advice it, because this would mean you can't make use of the WinRT framework. It would also mean you loose a lot of functionalities. For example what with search and share charms. These are essentially for a Metro app, but have no use in a web application.

The WinRT framework is also optimized for performance. So it is advised that you use that instead of a framework like jQuery or an other framework. The would probably be slower.

An other question you have to ask your self: If you can write it for the web, why would you want to turn it into a Metro app? What would be the value of that?

A last point I want to make is the following: Web apps are (for now) intended to work online. When working with a metro app you need to keep in mind that the application needs to work offline as well. This means an extra abstraction.

Like Andre mentioned in his answer. HTML5/JS only provides an extra way to develop an application. Microsoft just made it possible that more people could write apps in the language they feel familiar.

like image 34
Kristof Degrave Avatar answered Oct 16 '22 05:10

Kristof Degrave