Edit this page

up.layer up.layer.ask(options)
JavaScript function

Opens an overlay and returns a promise for its acceptance.

It's useful to think of overlays as promises which may either be fulfilled (accepted) or rejected (dismissed).


Instead of using up.layer.open() and passing callbacks, you may use up.layer.ask(). up.layer.ask() returns a promise for the acceptance value, which you can await:

let user = await up.layer.ask({ url: '/users/new' })
console.log("New user is " + user)

See also


options Object

See options for up.layer.open().

Return value

A promise that will settle when the overlay closes.

When the overlay was accepted, the promise will fulfill with the overlay's acceptance value.

When the overlay was dismissed, the promise will reject with the overlay's dismissal value.