Edit this page

up.Layer up.Layer.prototype.asCurrent(fn)
Instance method

Temporarily changes the current layer while the given function is running.

Calls the given function and restores the original current layer when the function terminates.

Example

up.layer.current // returns up.Layer.Root

up.layer.open() // open an overlay
up.layer.current // returns up.Layer.Modal

up.layer.parent.asCurrent(function() {
  up.layer.current // returns up.layer.Root
})

up.layer.current // returns up.Layer.Modal

Parameters

fn
required

The synchronous function to call.

Async functions are not supported.

Function()