Make command optional in messageOwnTab to be in line with messageTab

This commit is contained in:
petoncle 2023-10-30 11:34:40 +01:00
parent 50f4288ffc
commit fbc16a57f3
2 changed files with 4 additions and 5 deletions

View file

@ -55,7 +55,6 @@ import state, * as State from "@src/state"
import * as R from "ramda" import * as R from "ramda"
import { MinimalKey, minimalKeyFromKeyboardEvent } from "@src/lib/keyseq" import { MinimalKey, minimalKeyFromKeyboardEvent } from "@src/lib/keyseq"
import { TabGroupCompletionSource } from "@src/completions/TabGroup" import { TabGroupCompletionSource } from "@src/completions/TabGroup"
import {ownTabId} from "@src/lib/webext";
/** @hidden **/ /** @hidden **/
const logger = new Logger("cmdline") const logger = new Logger("cmdline")
@ -190,7 +189,7 @@ export function focus() {
commandline_state.clInput.focus() commandline_state.clInput.focus()
commandline_state.clInput.removeEventListener("blur", noblur) commandline_state.clInput.removeEventListener("blur", noblur)
commandline_state.clInput.addEventListener("blur", noblur) commandline_state.clInput.addEventListener("blur", noblur)
Messaging.messageTab(ownTabId(), "buffered_page_keys").then(consumeBufferedPageKeys) Messaging.messageOwnTab("buffered_page_keys").then(consumeBufferedPageKeys)
} }
/** @hidden **/ /** @hidden **/

View file

@ -133,7 +133,7 @@ export async function message<
/** Message the active tab of the currentWindow */ /** Message the active tab of the currentWindow */
export async function messageActiveTab( export async function messageActiveTab(
type: TabMessageType, type: TabMessageType,
command: string, command?: string,
args?: any[], args?: any[],
) { ) {
return messageTab(await activeTabId(), type, command, args) return messageTab(await activeTabId(), type, command, args)
@ -154,7 +154,7 @@ export async function messageTab(
} }
let _ownTabId let _ownTabId
export async function messageOwnTab(type: TabMessageType, command, args?) { export async function messageOwnTab(type: TabMessageType, command?, args?) {
if (_ownTabId === undefined) { if (_ownTabId === undefined) {
_ownTabId = await ownTabId() _ownTabId = await ownTabId()
} }
@ -165,7 +165,7 @@ export async function messageOwnTab(type: TabMessageType, command, args?) {
export async function messageAllTabs( export async function messageAllTabs(
type: TabMessageType, type: TabMessageType,
command: string, command?: string,
args?: any[], args?: any[],
) { ) {
const responses = [] const responses = []