Connect+Documentation
ExtensionsAPI reference

API reference

The connect.* dispatch model, the capability gate, and how to read each namespace page.

Every extension talks to Connect+ through the connect.* API — a single, uniform dispatch surface. This section documents each namespace on its own page, with every method and event, its required capability, and a runnable example. Start here for the model that all of them share.

The dispatch model

Under the sugar, the whole API is two primitives:

connect.call(ns, action, payload?, opts?);   // dispatch any connect.<ns>.<action>
connect.onEvent(ns, action, cb);              // subscribe to any connect.<ns>.on<Event>

Every namespace method (connect.storage.local.set(…), connect.tabs.query(…)) is a thin, typed wrapper over connect.call, and every onX subscription is a wrapper over connect.onEvent. If something isn't wrapped yet, or you're entitled to a new action, you can always reach it through these two.

A call crosses from your extension's context, through the preload bridge, to a provider in the main process — but only after passing the capability gate:

The gate is enforced in the main process, per profile, on every call — never on the extension's honor. A grant in one profile means nothing in another.

Capabilities

An extension declares the capabilities it needs in its manifest; the user grants them per profile. Declaring is a request, not a grant.

{
  "capabilities": [
    "storage",                              // a named capability
    "tabs.read",                            // a scoped sub-capability
    { "host": "https://*.example.com/*" }   // a host grant (match pattern)
  ]
}

Manage grants at runtime:

CallWhat it does
connect.capabilities.list()The capabilities currently granted in this profile.
connect.capabilities.contains(cap)Whether a specific capability is granted.
connect.capabilities.request(caps)Prompt the user to grant more; resolves { granted: string[] }.

A call that needs a capability you don't hold rejects with code: 'CAPABILITY_DENIED' — the cue to request it and retry:

try {
  await connect.history.list();
} catch (err) {
  if (err.code === 'CAPABILITY_DENIED') {
    const { granted } = await connect.capabilities.request(['history.read']);
    if (granted.includes('history.read')) return connect.history.list();
  }
  throw err;
}

Host grants ({ host: "<match pattern>" }) authorize acting on matching URLs — injecting content scripts, capturing a tab, reading cookies for that host. Pixels and page access are as sensitive as injection, so there is no ambient, host-free version of those abilities.

How to read a namespace page

Each page follows the same shape:

  • Overview — what the namespace is for and the capability it needs.
  • Methods — one section each: signature, parameters, return value, example.
  • Events — one section each: when it fires and its payload.

Jump to a namespace from the sidebar, or use search (Ctrl/⌘ K) to go straight to a method or event by name.

On this page