Trigger.io

Trigger.io Forge Documentation

Important

This documentation is deprecated, and only kept here to support users of browser extension APIs. If you are using Trigger.io for iOS or Android, see https://trigger.io/docs/.

tabs: Tabs Management

Tabs management provides functionality specific to tabs.

Config

The tabs module must be enabled in config.json

{
    "modules": {
        "tabs": true
    }
}

API

open

Platforms: All except web

Opens a new tab with the specified url with an option to retain focus on the calling tab.

On mobile this will display a modal view and the success callback will be called with an object containing a url and optionally a userClosed boolean property.

tabs.open(url[, keepFocus], success, error)
Arguments:
  • url (string) -- The URL to open in the new tab
  • keepFocus (boolean) -- (optional) If true keeps the current tab focused
  • success (function(object)) -- callback to be invoked when no errors occurs
  • error (function(content)) -- called with details of any error which may occur

openWithOptions

Platforms: All except web

As open but takes an object with the following parameters:

Required:

  • url: Required URL to open

Browser only:

  • keepFocus: Whether or not to keep focus on the current page.

Mobile only:

  • pattern: Pattern to close the modal view, see modal views for more detail.
  • title: Title of the modal view.
  • tint: Colour to tint the top bar of the modal view. An array of four integers in the range [0,255] that make up the RGBA color. For example, opaque red is [255, 0, 0, 255].
  • buttonText: Text to show in the button to close the modal view.
  • buttonIcon: Icon to show in the button to close the modal view, if buttonIcon is specified buttonText will be ignored.
  • buttonTint: Colour to tint the button of the top bar in the modal view.

Example:

forge.tabs.openWithOptions({
  url: 'http://my.server.com/login/',
  pattern: 'http://my.server.com/loggedin/*',
  title: 'Login Page'
}, function (data) {
  forge.logging.log(data.url);
});
tabs.openWithOptions(options, success, error)
Arguments:
  • options (object) -- Object containing url and optional properties.
  • success (function(object)) -- callback to be invoked when no errors occurs
  • error (function(content)) -- called with details of any error which may occur

closeCurrent

Platforms: Browser only

Restrictions: Only available inside a page (not from a background script)

Close the tab which makes the call.

tabs.closeCurrent(error)
Arguments:
  • error (function(content)) -- called with details of any error which may occur

Permissions

On Chrome this module will add the tabs permission to your app, users will be prompted to accept this when they install your app.