AboutSupportDeveloper GuideVersion 37.124.81.26

Static namespace for OpenFin API methods that interact with the Window class, available under fin.Window.

Hierarchy

  • Base
    • _WindowModule

Accessors

  • get me(): Identity
  • Provides access to the OpenFin representation of the current code context (usually a document such as a View or Window), as well as to the current Interop context.

    Useful for debugging in the devtools console, where this will intelligently type itself based on the context in which the devtools panel was opened.

    Returns Identity

Methods

  • Creates a new Window.

    Parameters

    Returns Promise<Window>

    Example

    async function createWindow() {
    const winOption = {
    name:'child',
    defaultWidth: 300,
    defaultHeight: 300,
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.create.html',
    frame: true,
    autoShow: true
    };
    return await fin.Window.create(winOption);
    }

    createWindow().then(() => console.log('Window is created')).catch(err => console.log(err));
  • Asynchronously returns a Window object that represents the current window

    Returns Promise<Window>

    Example

    fin.Window.getCurrent()
    .then(wnd => console.log('current window'))
    .catch(err => console.log(err));
  • Synchronously returns a Window object that represents the current window

    Returns Window

    Example

    const wnd = fin.Window.getCurrentSync();
    const info = await wnd.getInfo();
    console.log(info);
  • Asynchronously returns an API handle for the given Window identity.

    Parameters

    Returns Promise<Window>

    Remarks

    Wrapping a Window identity that does not yet exist will not throw an error, and instead returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing for a Window throughout its entire lifecycle.

    Example

    async function createWin() {
    const app = await fin.Application.start({
    name: 'myApp',
    uuid: 'app-1',
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.wrap.html',
    autoShow: true
    });
    return await app.getWindow();
    }
    createWin().then(() => fin.Window.wrap({ uuid: 'app-1', name: 'myApp' }))
    .then(win => console.log('wrapped window'))
    .catch(err => console.log(err));
  • Synchronously returns an API handle for the given Window identity.

    Parameters

    Returns Window

    Remarks

    Wrapping a Window identity that does not yet exist will not throw an error, and instead returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing for a Window throughout its entire lifecycle.

    Example

    async function createWin() {
    const app = await fin.Application.start({
    name: 'myApp',
    uuid: 'app-1',
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.wrapSync.html',
    autoShow: true
    });
    return await app.getWindow();
    }
    await createWin();
    let win = fin.Window.wrapSync({ uuid: 'app-1', name: 'myApp' });