Trigger Event Logic
  • 18 Aug 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Trigger Event Logic

  • Dark
    Light
  • PDF

Article Summary

Introduction

Global canvas is a page that exists in the context of the whole app, meaning that logic that is present here can be accessed from all points within the app. With that in mind, we can optimize repetitive logic execution for our app and abstain from configuring the same flow multiple times.

Configuring the Global Canvas

Navigate to the Global Canvas and open the Logic canvas.

GlobalCanvasToLogic

Select an unused 'Event' function or drag a new one from the 'Advanced' section of the flow functions tab. In its 'Properties' tab, change the 'Event source' to be "Fired from "Trigger event"". Expand the 'Advanced' dropdown below and choose a name for your event. It is of best practice here to choose an easily recognizable name.

If done correctly, your event should look a similar way:

Final result

From here, everything that you attach to this event will be a part of it, and thus, will be 'callable' from elsewhere in the app. For instance, you can attach a 'Delete record' flow function that removes all entries on the local database:

Delete Record Example

Note!

It is not possible to use app variables and app parameters here, as they exist only within the context of a specific page.

Calling the logic

To use the configured logic somewhere else, you need to add a "Trigger event" flow function anywhere in your app and set the 'Triggered event' property to be the name of your logic on the global canvas.

For instance, attaching the trigger event to Button's 'Component tap' creates a button that empties the local storage everytime it is pressed:

Button on-device wipe example

Furthermore, this logic can be re-used as much as needed via the 'Trigger event' flow function with the same settings.


Was this article helpful?

What's Next