Top bar

The app appears as an icon on the right side of the bar along the top of the agent interface. Clicking the icon opens the app.

Example manifest

"location": {  "support": {    "top_bar": "assets/iframe.html"  }},

See Setting the app location.

In addition to the objects available in all locations, the following additional actions are available in this location:

Events

In addition to the core events, the following events are available to an app in the top bar:

By default, the pane view of a nav bar or top bar app is only inserted into the DOM the first time the app is opened by the user. If you need to insert the pane into the DOM without making it visible, see the preloadPane action in the nav bar documentation.

Once the app pane is in the DOM, users can switch away and back to it.

pane.activated

Fires when the user returns to a top_bar or nav_bar app that's already been opened. It doesn't fire when the app is first displayed after loading. Consider using the app.registered event in that case.

client.on('pane.activated', function() {  //handler code});

pane.deactivated

Fires when the user switches away from your app and the app is no longer visible.

client.on('pane.deactivated', function() {  //handler code});

Actions

The following additional actions are available in this location:

popover

You can use the popover API to show, hide, or resize top bar apps.

invoke
client.invoke('popover', {  width: 400, // The special value auto is also allowed for the height property only  height: 200})
client.invoke('popover', 'show') // possible values: 'toggle', 'hide' or 'show'. Default: 'show'.

Note: The popover API only changes the size of the popover. It doesn't change the size of your iframe. The resize action changes the size of both the iframe and the popover for top bar apps.

preloadPane

By default, the pane view of a nav bar or top bar app is only inserted into the DOM the first time the app is opened. Calling preloadPane causes the pane view to be inserted into the DOM in advance, but it won't be visible until the app is opened. This is useful in cases where you need to manipulate the DOM before the app is made visible or if you have an iframe that needs to be preloaded. When the app pane is created, the framework fires the pane.created event.

Note: You can only call preloadPane with the instances API from a location loaded earlier. In most cases however, performing background tasks directly from the background location is preferred to preloading the pane.

invoke
instanceClient.invoke('preloadPane') // called from another location using the instances API.

iconSymbol

Changes the SVG icon. See iconSymbol API.

set
client.set('iconSymbol', symbolName)
arguments
  • symbolName the value of a id attribute in a <symbol id="mySymbol"> tag in your SVG file.

Note: You can't use the iconSymbol property to change an app icon in the overflow menu.

iconChars

Changes the SVG icon to the two characters provided. Supports UTF8.

invoke
client.invoke('iconChars', twoChars)client.invoke('iconChars', 'Wi')client.invoke('iconChars', '∑✈')
arguments
  • twoChars is a string of two characters that will be put into the nav_bar icon.

Note: You can't use the iconChars property to change an app icon in the overflow menu.