Window Open Promise Reference
πͺ Promised Window.open();
.
Usage
π¦ Node
Install window-open-promise
as a dependency:
Import it and use it:
π¦ Deno
Import window-open-promise
using the npm:
prefix, and use it directly:
π Browser
Import window-open-promise
using esm.sh, and use it directly:
Useful links
- π Documentation: TypeDoc generated documentation.
- β³ Changelog: List of changes between versions.
- β Tests Coverage: Coveralls page with tests coverage.
Type Aliases
WindowOpenPromiseFeatures
Ζ¬ WindowOpenPromiseFeatures:
Omit
<WindowOpenPromiseOptions
,
"replace"
| "target"
| "url"
>
WindowOpenPromise features.
WindowOpenPromiseOptions
Ζ¬ WindowOpenPromiseOptions: Object
WindowOpenPromise options.
Type declaration
Name | Type | Description |
---|---|---|
height (optional) | number | WindowOpenPromise height (minimum 100). |
left (optional) | number | WindowOpenPromise left position. |
menuBar (optional) | boolean | WindowOpenPromise renders the menu bar. |
noOpener (optional) | boolean | WindowOpenPromise canβt access itβs opener. |
resizable (optional) | boolean | WindowOpenPromise is resizable. |
scrollbars (optional) | boolean | WindowOpenPromise has scrollbars. |
target (optional) | string | WindowOpenPromise target. |
titleBar (optional) | boolean | WindowOpenPromise renders the title bar. |
toolBar (optional) | boolean | WindowOpenPromise renders the tool bar. |
top (optional) | number | WindowOpenPromise top position. |
url (optional) | string | WindowOpenPromise url. |
width (optional) | number | WindowOpenPromise width (minimum 100). |
Functions
featureJoin
βΈ featureJoin<Item
>(iterable
): string
Joins given array of features with the FEATURE_SEPARATOR.
Type parameters
Name | Type |
---|---|
Item | extends Strigifiable |
Parameters
Name | Type |
---|---|
iterable | Object |
iterable.[iterator] | () => Iterator <Item , any , undefined > |
Returns
string
Joint string.
Example
featureMap
βΈ featureMap(iterable
): Object
Maps array of feature entries to valid values.
Parameters
Name | Type |
---|---|
iterable | Object |
iterable.[iterator] | () => Iterator <EntryOf <WindowOpenPromiseFeatures >, any , undefined > |
Returns
Object
Array of formatted features.
Name | Type |
---|---|
[iterator] | () => IterableIterator <string > |
next | (β¦args : [] | [undefined ]) => IteratorResult <string , any > |
return (optional) | (value? : any ) => IteratorResult <string , any > |
throw (optional) | (e? : any ) => IteratorResult <string , any > |
Example
featureParser
βΈ featureParser(features?
): string
Parses features object into features string.
Parameters
Name | Type | Description |
---|---|---|
features (optional) | WindowOpenPromiseFeatures | Features object. |
Returns
string
Parsed string.
Example
featureValueMapper
βΈ featureValueMapper(value
): number
Takes a feature value and returns a formatted feature value.
Parameters
Name | Type |
---|---|
value | unknown |
Returns
number
Feature value.
Example
windowOpenPromise
βΈ windowOpenPromise(global
): (options
:
WindowOpenPromiseOptions
)
=> Promise
<Window
>
Promised Window.open.
Parameters
Name | Type |
---|---|
global | Readonly <Pick <Window , "open" >> |
Returns
fn
Curried function with window
in context.
βΈ (options?
): Promise
<Window
>
Curried function with window
set.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
options | WindowOpenPromiseOptions | EMPTY_OBJECT | WindowOpenPromise options. |
Returns
Promise
<Window
>
Promise with new window.
Example
Example