Options
All
  • Public
  • Public/Protected
  • All
Menu

External module Snap-and-Dock

Index

Events

addEventListener

  • addEventListener(eventType: "window-docked", listener: function): Promise<void>
  • addEventListener(eventType: "window-undocked", listener: function): Promise<void>
  • Event fired when one window is docked to another.

    It is not possible to receive events for another window. When adding a listener, the listener will only ever fire for the "fin.desktop.Window.getCurrent()" window.

    import {addEventListener} from 'openfin-layouts';
    
    addEventListener('window-docked', async (event: WindowDockedEvent) => {
        console.log("Docked to another window");
    
        // Using 'v1' API
        fin.desktop.Window.getCurrent().getGroup((windows) => {
            console.log("Windows in current group: ", windows);
        });
    
        // Using 'v2' API
        console.log("Windows in current group: ", await fin.Window.getCurrentSync().getGroup());
    });

    The service considers any windows that are tabbed together to also be in the same snap group, so this event will also fire when a window is added to a tab group. This may change in future versions of the service.

    type

    window-docked

    Parameters

    Returns Promise<void>

  • Event fired when one window is undocked from it's neighbor(s).

    It is not possible to receive events for another window. When adding a listener, the listener will only ever fire for the "fin.desktop.Window.getCurrent()" window.

    import {addEventListener} from 'openfin-layouts';
    
    addEventListener('window-undocked', async (event: WindowUndockedEvent) => {
        console.log("Undocked from another window");
    
        // Using 'v1' API
        fin.desktop.Window.getCurrent().getGroup((windows) => {
            console.log("Windows in current group: ", windows);
        });
    
        // Using 'v2' API
        console.log("Windows in current group: ", await fin.Window.getCurrentSync().getGroup());
    });

    The service considers any windows that are tabbed together to also be in the same snap group, so this event will also fire when a window is removed from a tab group. This may change in future versions of the service.

    type

    window-undocked

    Parameters

    Returns Promise<void>

Functions

undockGroup

  • undockGroup(identity?: Identity): Promise<void>
  • Will undock every window that is currently connected to a current window.

    This will completely disband the entire group, not just the windows directly touching identity.

    Has no effect if identity isn't currently snapped to any other window.

    import {snapAndDock} from 'openfin-layouts';
    
    // Undock all windows attached to the current window (all are equivilant)
    snapAndDock.undockGroup();
    snapAndDock.undockGroup(fin.desktop.Window.getCurrent());   // Using 'v1' API
    snapAndDock.undockGroup(fin.Window.getCurrentSync());       // Using 'v2' API
    
    // Undock all windows attached to a different window
    snapAndDock.undockGroup({uuid: 'my-app', name: 'other-window'});
    throws

    Error: If identity is not a valid {@link Identity}

    throws

    Error: If the window specified by identity does not exist

    throws

    Error: If the window specified by identity has been de-registered

    Parameters

    • Default value identity: Identity = getId()

      A window belonging to the group that should be disbanded, defaults to the current window/group

    Returns Promise<void>

undockWindow

  • undockWindow(identity?: Identity): Promise<void>
  • Undocks a window from any group it currently belongs to.

    Has no effect if the window is not currently docked.

    import {snapAndDock} from 'openfin-layouts';
    
    // Undock the current window (all are equivilant)
    snapAndDock.undockWindow();
    snapAndDock.undockWindow(fin.desktop.Window.getCurrent());   // Using 'v1' API
    snapAndDock.undockWindow(fin.Window.getCurrentSync());       // Using 'v2' API
    
    // Undock a different window
    snapAndDock.undockWindow({uuid: 'my-app', name: 'other-window'});
    throws

    Error: If identity is not a valid {@link Identity}

    throws

    Error: If the window specified by identity does not exist

    throws

    Error: If the window specified by identity has been de-registered

    Parameters

    • Default value identity: Identity = getId()

      The window to undock, defaults to the current window

    Returns Promise<void>