Global Object
The Global
object is available when building backend API steps or writing frontend JavaScript within Applications. It holds metadata such as the current URL, the end-user accessing the application, or the browser's local storage. This metadata can be used to reference a user's groups in code or access the query parameters to dynamically pass data between applications. Use CMD
/CTRL
+ k
to pull up the Global
object as well as other available variables in backend API steps or when writing JavaScript inside frontend components.
Application created and deployed times are presented in ISO 8601 string format. These can be modified into other formats such as with JavaScript's moment library:
{{moment(Global.deployedAt).format("MM/DD/YYYY HH:mm:ss")}}
Available metadata
Metadata type | Property | Description | Full Path |
---|---|---|---|
Application | createdAt | The application creation time in ISO 8601 string (UTC) | Global.createdAt |
Application | deployedAt | The application deployment time in ISO 8601 string (UTC) | Global.deployedAt |
Application | mode | The mode the application is in when the user views it EDIT , PREVIEW , or PUBLISHED | Global.mode |
User | email | The email associated with the end-user viewing and using the application | Global.user.email |
User | groups | An array of all the groups of which the end-user viewing and using the application is a member | Global.user.groups |
User | id | The id associated with the end-user viewing and using the application | Global.user.id |
User | username | The username associated with the end-user viewing and using the application | Global.user.username |
Groups | groups | An array of all the permissions groups in your Superblocks organization | Global.groups |
URL | fullpath | A string representation of the full URL of the application | Global.URL.fullpath |
URL | host | The host component of the URL (e.g. app.superblockshq.com ) | Global.URL.host |
URL | pathname | The path component of the URL (e.g. /applications/123/pages/456 ) | Global.URL.pathname |
URL | queryParams | An object containing key-value pairs representing the query parameters present in the URL. | Global.URL.queryParams |
URL | store | An object containing key-value pairs representing the contents of the browser's local storage | Global.URL.store |