双屏显示——NW.js

1、利用w10中的双屏显示设置(扩展模式)

2、Code for second window:

 1 var gui = require('nw.gui');
 2 gui.Screen.Init();
 3 win = gui.Window.get();
 4 if (win.x < gui.Screen.screens[gui.Screen.screens.length -1].work_area.x) win.x = gui.Screen.screens[gui.Screen.screens.length -1].work_area.x + win.x;
 5 
 6 var screenCB = {
 7     onDisplayAdded : function(screen) {
 8         win = gui.Window.get();
 9         if (win.x < screen.work_area.x) win.x = screen.work_area.x + win.x;
10     }
11 };
12 
13 gui.Screen.on('displayAdded', screenCB.onDisplayAdded);

Screen API:

    【http://docs.nwjs.io/en/latest/References/Screen/

    【https://github.com/nwjs/nw.js/wiki/Screen

      

原文地址:https://www.cnblogs.com/softwarefang/p/7412493.html