Noosphere Possibilities Maximized
Miss any of our Open RFC calls?Watch the recordings here! »

@vangware/window-open-promise

3.0.3 • Public • Published

@vangware/window-open-promise logo

Build Status License NPM Version Open Issues Size

Promised Window.open.

Usage

📦 Node

import windowOpenPromise from "@vangware/window-open-promise";
 
windowOpenPromise({
    url: "https://example.com", // URL is not required, you can open a blank window
    features: { alwaysOnTop: true }
})
    .then(newWindow => {
        newWindow.console.log("This will log in the new window.");
        newWindow.addEventListener("beforeunload", _event => {
            console.log("This will log when the new window is closed.");
        });
    })
    .catch(_error => {
        console.error("This will log if the new window can't be opened.");
    });

🦕 Deno

import windowOpenPromise from "https://cdn.skypack.dev/@vangware/window-open-promise";
 
try {
    const newWindow = await windowOpenPromise({
        url: "https://example.com", // URL is not required, you can open a blank window
        features: { alwaysOnTop: true }
    })
    newWindow.console.log("This will log in the new window.");
    newWindow.addEventListener("beforeunload", _event => {
      console.log("This will log when the new window is closed.");
    });
} catch (_error) {
    console.error("This will log if the new window can't be opened.");
}

Install

npm i @vangware/window-open-promise

DownloadsWeekly Downloads

61

Version

3.0.3

License

MIT

Unpacked Size

21.5 kB

Total Files

32

Last publish

Collaborators

  • avatar