summaryrefslogtreecommitdiffstats
path: root/mobile/android/components/extensions/ext-c-tabs.js
blob: 7e00627c7c72278ae00c03ed32bf22b636238683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"use strict";

this.tabs = class extends ExtensionAPI {
  getAPI(context) {
    return {
      tabs: {
        connect(tabId, options) {
          const { frameId = null, name = "" } = options || {};
          return context.messenger.connect({ name, tabId, frameId });
        },

        sendMessage(tabId, message, options, callback) {
          const arg = { tabId, frameId: options?.frameId, message, callback };
          return context.messenger.sendRuntimeMessage(arg);
        },
      },
    };
  }
};