journey.viewStack

Version compatibility

journey.viewStack was introduced in version 4.40.1 of the JourneyApps Container.

The view stack is exposed to developers as journey.viewStack.

Example usage:

var views = journey.viewStack.views() // returns an array of view instances

var myView = journey.viewStack.findFirst('my_view_path'); // view instance or null

var myView = journey.viewStack.findLast('my_view_path'); // view instance or null
var myView = journey.viewStack.find('my_view_path'); // view instance or null

A view instance contains the following items:

Name
Type
Comment

path

string

The path name of the view, e.g. "inventory".

index

number

The position of the view on the stack, e.g. 3.

variables

object

Read-only object of the view variables.

journey.viewStack.findFirst() finds the first instance of the view on the stack, i.e. the one closest to the 'main' view.

journey.viewStack.findLast() finds the last instance of the view on the stack, i.e. the one closest to the current view. Since finding the last view on the stack is the more common, you can also use the alias journey.viewStack.find().

Last updated