🪟 Promised Window.open();
.
import { windowOpenPromise } from "@vangware/window-open-promise";
const windowOpen = windowOpenPromise(window);
windowOpen({
url: "https://example.com", // URL is not required, you can open a blank window
top: 10,
left: 10
})
.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.");
});
import { windowOpenPromise } from "https://cdn.skypack.dev/@vangware/window-open-promise?dts";
const windowOpen = windowOpenPromise(window);
try {
const newWindow = await windowOpen({
url: "https://example.com", // URL is not required, you can open a blank window
top: 10,
left: 10
})
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.");
}
Documentation can be found HERE. It is auto-generated with typedoc based on the JSDocs and the types in the source. Shouldn't be necessary to read this, code editors like VSCode integrate the documentation in the UI.
Changelog can be found HERE.
Test coverage can be found HERE.
WindowOpenPromise options.
WindowOpenPromise height (minimum 100).
WindowOpenPromise left position.
WindowOpenPromise renders the menu bar.
WindowOpenPromise can't access it's opener.
WindowOpenPromise replace.
WindowOpenPromise is resizable.
WindowOpenPromise has scrollbars.
WindowOpenPromise target.
WindowOpenPromise renders the title bar.
WindowOpenPromise renders the tool bar.
WindowOpenPromise top position.
WindowOpenPromise url.
WindowOpenPromise width (minimum 100).
Parses features object into features string.
Features object.
Parsed string.
Promised Window.open.
Window object (or maybe a mock :D).
Curried function with window
in context.
Generated using TypeDoc
WindowOpenPromise features.