App Module
Required Permissions: none
The app module is used to querying the state of your app and managing it as it exists inside Streamlabs Desktop.
Minimum Version
This API was added in Build 6.
NavigationDetails object
object
This object describes a navigation to your app's top_nav
page. If the user navigated to your page by clicking on the navigation, the object will be empty. If the user navigated to your page via clicking on source properties and was redirected (via the redirectPropertiesToTopNavSlot
option), then the sourceId
will be included in the object.
Property | Type | Description |
---|---|---|
sourceId | string | If your page was navigated to via a redirect from source properties, then this attribute will be present on the navigation object, and contains the id of the source that was clicked on. |
onNavigation method
method
onNavigation(callback: Function): void
This function can be used to bind a callback that will be called when the user navigates to your app's top_nav
page. Please note that this function is only useful for persistent
pages, since your app page needs to be running before it is navigated to receive the event.
This function is most useful when you want to show a settings UI for a particular source, in conjunction with per-source settings available within the Sources Module.
Arguments
callback
: This is a callback function that takes a NavigationDetails object as its only argument.
Returns
None
Example
streamlabsOBS.v1.App.onNavigation(nav => {
console.log('got nav to source', nav.sourceId);
// Show UI for source settings
});
navigate method
method
navigate(page: string): void
Navigate to another page in Streamlabs Desktop. `page should be one of:
Editor
Dashboard
Live
Themes
AppDetailsPage
Arguments
page
: The page to navigate to
Returns
None
Example
streamlabsOBS.v1.App.navigate('Editor');
reload method
method
navigate(page: string): void
Refreshes all currently running pages and sources belonging to your app.
Arguments
None
Returns
None
Example
streamlabsOBS.v1.App.reload();
Updated almost 3 years ago