How to use the @morgan-stanley/desktopjs.SnapAssistWindowManager function in @morgan-stanley/desktopjs

To help you get started, we’ve selected a few @morgan-stanley/desktopjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Morgan-Stanley / desktopJS / examples / electron / electron.js View on Github external
function createWindow() {
    let container = desktopJS.resolveContainer({node: true});

    desktopJS.ContainerWindow.addListener("window-created", (e) => container.log("info", "Window created - static (ContainerWindow): " + e.windowId + ", " + e.windowName));
	desktopJS.ContainerWindow.addListener("window-joinGroup", (e) => container.log("info", "grouped " + JSON.stringify(e)));
	desktopJS.ContainerWindow.addListener("window-leaveGroup", (e) => container.log("info", "ungrouped" +  JSON.stringify(e)));
    
    snapAssist = new desktopJS.SnapAssistWindowManager(container,
        {
            windowStateTracking: desktopJS.WindowStateTracking.Main | desktopJS.WindowStateTracking.Group
        });

    container.createWindow('http://localhost:8000', { name: "desktopJS", main: true }).then(win => mainWindow = win);
 
    let trayIcon = electron.nativeImage.createFromPath(__dirname + '\\..\\web\\favicon.ico');
    container.addTrayIcon({ icon: trayIcon, text: 'ContainerPOC' }, () => {
        mainWindow.isShowing().then((showing) => {
            if (showing) {
                mainWindow.hide();
            } else {
                mainWindow.show();
            }
        });
    }, [{ label: "Exit", click: (menuItem) => app.quit() }]);

@morgan-stanley/desktopjs

Library for abstracting common container hosting

Apache-2.0
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis