Skip to main content

Scope

To build Multi-Page Apps in Superblocks, it is important to understand how resources, such as Frontent Variables, APIs, Timers, Events, and more are scoped.

Scope enables you to keep your application cleanly organized, while also sharing and reusing resources and data across pages.

info

App scope is not yet supported but is coming very soon. At this time, all resources are page-level only.

Page vs App Scope

At a high-level, each resource in a Superblocks Application must belong to either a specific page or the app. The entity that the resource belongs to is referred to as the "level". For example, we can have a page-level or app-level frotend variable.

The level of the resource dictates where the resource can be accessed, as well as how other resources are references.

Page level

When a resource is defined at the page-level, it can access anything else on the same page, or anything app-level.

What can be referenced from this scope?How do I reference resources at this level?
Other page-level resources on this specific pageNo prefix - Ex: {{ variable1.value }} refers to a page-level variable variable1
App-level resources [coming soon!]App. prefix - Ex: {{ App.variable1.value }} refers to an app-level variable variable1

[Coming soon] App level

When a resource is defined at the app-level, it can only access other resources at the app-level.

What can be referenced from this scope?How do I reference resources at this level?
App-level resourcesNo prefix - Ex: {{ variable1.value }} refers to an app-level variable variable1