1つ以上のタブを閉じます。
この関数は Promise
を返す非同期関数です。
構文
var removing = browser.tabs.remove(
tabIds // integer or integer array
)
パラメータ
tabIds
またはinteger
. 閉じるタブのIDを指定します。array
ofinteger
戻り値
A Promise
that will be fulfilled with no arguments when all the specified tabs have been removed or their beforeunload
prompts have been handled. If any error occurs, the promise will be rejected with an error message.
ブラウザ実装状況
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
例
タブを1つだけ閉じる場合:
function onRemoved() {
console.log(`Removed`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
var removing = browser.tabs.remove(2);
removing.then(onRemoved, onError);
複数のタブを閉じる場合:
function onRemoved() {
console.log(`Removed`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
var removing = browser.tabs.remove([15, 14, 1]);
removing.then(onRemoved, onError);
Example extensions
この API は Chromium の chrome.tabs
APIに基づいています。 This documentation is derived from tabs.json
in the Chromium code.
Microsoft Edge での実装状況は Microsoft Corporation から提供されたものであり、ここでは Creative Commons Attribution 3.0 United States License に従っています。