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 | Readonly <Iterable <Item >> |
Returns
string
Joint string.
Example
featureMap
βΈ featureMap(iterable
): Readonly
<IterableIterator
<string
>>
Maps array of feature entries to valid values.
Parameters
Name | Type |
---|---|
iterable | Readonly <Iterable <EntryOf <WindowOpenPromiseFeatures >>> |
Returns
Readonly
<IterableIterator
<string
>>
Array of formatted features.
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
)
=> { catch
: <RejectedValue_1>(this
: void
, onrejected?
:
Unary
<unknown
, RejectedValue_1
| PromiseLike
<RejectedValue_1
>>)
=> Promise
<Window
| RejectedValue_1
> ; then
: <ResolvedValue,
RejectedValue>(this
: void
, onResolved?
: Unary
<Window
,
ResolvedValue
| PromiseLike
<ResolvedValue
>>, onRejected?
:
Unary
<unknown
, RejectedValue
| PromiseLike
<RejectedValue
>>) =>
Promise
<ResolvedValue
| RejectedValue
> }
Promised Window.open.
Parameters
Name | Type |
---|---|
global | Readonly <Pick <Window , "open" >> |
Returns
fn
Curried function with window
in context.
βΈ (options?
): Object
Curried function with window
set.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
options | WindowOpenPromiseOptions | EMPTY_OBJECT | WindowOpenPromise options. |
Returns
Object
Promise with new window.
Name | Type | Description |
---|---|---|
catch | <RejectedValue_1>(this : void , onrejected? : Unary <unknown , RejectedValue_1 | PromiseLike <RejectedValue_1 >>) => Promise <Window | RejectedValue_1 > | - |
then | <ResolvedValue, RejectedValue>(this : void , onResolved? : Unary <Window , ResolvedValue | PromiseLike <ResolvedValue >>, onRejected? : Unary <unknown , RejectedValue | PromiseLike <RejectedValue >>) => Promise <ResolvedValue | RejectedValue > | - |
Example
Example