JavaScript Callbacks and Actions


Available Callbacks

From within your JavaScript code, you can trigger certain actions as well as listen for callbacks. 


  • TB.render
  • before-page-change


  • TB.showComponent
  • TB.hideComponent
  • TB.navigateToPageId  // pageId
  • TB.navigateTo  //page slug
  • TB.showAlert

Show an Alert

Populate a popup element with text-only content.

Parameter Type Description
Message string Alert message.
Type string

Various types of alert-success, warning, error, info and wait.   


Popup : this

Action a custom alert

TB.showAlert("This is a custom Alert", "success");

Show Component

Show component when a component is already hidden.

Parameter Type Description
ComponentId string Id of component.

Component Id found here:



Action a show component



Hide Component

Hide component when a component is visible.

Parameter Type Description
ComponentId string Id of component.



Action to hide the component



Navigate to Page

Navigate page by page id.

Parameter Type Description
pageId string Id of page.

Page id found here:



Action to Navigate page by page id.



Navigate to

Navigate page by page slug.

Parameter Type Description
pageSlug string

Slug of page.

Page slug found here: Go to page setting in your app builder.



Action to Navigate using page slug.




Get all data of components.

Parameter Type Description
componentId string

Id of component or 'any' for all components. 


Callback function


Object{     ele : "HTML ELEMENT", // String     objI:"OBJECT_ID", // String     records : [] // Array
type : "TYPE OF component"


Trigger to Navigate using page slug.

TB.render("component_20", function(data){
    console.log("component_data", data)


Before Page Change

Listen for an attempt to change navigation. 

Parameter Type Description
Event Name string before-page-change
Page ID string The ID of the page to listen for
Callback   Callback function

You can get the page ID from the builder. When working with a child page, make sure to use the second ID. 

Code Sample:

TB.registerEvent('before-page-change', "K2ejlOQo9B", function() { 
    console.log("Page in about to be changed");



When a page is about to be navigated away from, require confirmation before changing pages. If the user doesn't confirm the request for the alert, the page will remain present. 

TB.registerEvent('before-page-change', "K2ejlOQo9B", function() { 
    if (confirm('Are you sure you want to leave?')) {
    } else {
      return false;