CBA

Chromium Browser Automation (extension for chrome browser automation)

bg-inject

bg-inject provides ability of injecting script into backroung page of the extension where you can also access browser api.

browser.tabs.create({url: "https://example.org"});

Clipboard

It's handy to use clipboard object to pass data from the page to the bg-inject actions.

#page-url
browser.tabs.create({url: clipboard["copy"]});

actionToPlay

actionToPlay function is used for jumping to another action.

if (clipboard["jumpToFirstAction"])
{
  actionToPlay(1);
}

async/await

You can also use async/await in the bg-inject that way you can wait for an async function execution before proceeding with the next action.

const [tab] = await browser.tabs.query({active: true});
await browser.tabs.remove(tab.id);