Note: This is a pre-release of Bagawork. Many things will likely change before the first stable release.

Direction

On this page you find the documentation for the Direction class.

Introduction

The Direction class represents a possible navigation from one Page to another Page. It consists of the following parts:

  • when: A boolean value indicating if this Direction should be used
  • page: The Page the user should come to
  • description: A text describing when the Direction should be used (used when previewing the app in our Online Editor)

A Page usually contains multiple Directions, and when the user has interacted with the Page (for example clicked on a Button), the first Direction in the Page whose when is true will be used to transition to the page in that Direction.

Creating a Direction

To create a new Direction object, simply write:

Direction

To indicate when/if this direction should be used, call the configuration method when(), and pass it the boolean value, e.g.:

Direction.when(true)

To indicate which page the user should come to when this direction is used, call the configuration method page(), and pass it the page, e.g.:

Direction.when(true).page(ThePage)

To instruct the editor which text to show, call the configuration method text(), and pass it the text, e.g.:

Direction.when(true).page(ThePage).text(`This is shown in the editor`)