WinJSContrib.MultiView (NuGet package)

Since Windows 8.1, an application can have multiple screens. Each screen is bound to the same process, but each one has it's own UI thread. From a javascript perspective, it means that each screen is independant, and that you must use some kind of messaging to communicate between them.
please note that this will not work on Windows Phone 8.1 or outside Windows 8 application

This package is here to simplifies implementing multiple screens in your app and provide the messaging system.

To have multiple screens, you will need to create a page to host the child views. Make a copy of your default.html, name it defaultchild.html and remove the script reference to default.js. Now add the following references :
<script src="/scripts/winjscontrib/mcnext.ui.multipleviews.js.js"></script>
<script src="/scripts/winjscontrib/mcnext.ui.multipleviews.child.js"></script>

In default.html, add references to the multiview component :
<script src="/scripts/winjscontrib/mcnext.ui.multipleviews.js.js"></script>
<script src="/scripts/winjscontrib/mcnext.ui.multipleviews.main.js"></script>

Now you are ready to open pages in a second view. You will just need to call :

	//send message to the view
	arg.view.send("helloworld", { data : 'some stuff'});

Last edited Apr 11, 2014 at 9:16 AM by gleborgne, version 3