Reading: chrome.extension – Flickroom
Contents
getBackgroundPage
chrome.extension.getBackgroundPage()
Foreground only
Returns the JavaScript ‘window ‘ aim for the background page running inside the current extension. Returns nothing if the extension has no setting page .
Returns
- Window | undefined
getExtensionTabs
chrome.extension.getExtensionTabs(
windowId?:
number
,
)
≤MV2
Foreground only
Deprecated
Please use extension.getViews
{type: "tab"}
. Returns an array of the JavaScript ‘window ‘ objects for each of the tab running inside the stream reference. If windowId
is specified, returns entirely the ‘window ‘ objects of tabs attached to the specified window .
Parameters
- windowId count optional
Returns
- Window array of global window objects
getURL
chrome.extension.getURL(
path:
string
,
)
≤MV2
Deprecated since Chrome 58
Please use runtime.getURL
. Converts a relative path within an reference install directory to a fully-qualified URL .
Parameters
- path string A path to a resource within an extension expressed relative to its install directory .
Returns
- chain The fully-qualified URL to the resource .
getViews
chrome.extension.getViews(
fetchProperties?:
object
,
)
Foreground only
Returns an array of the JavaScript ‘window ‘ objects for each of the pages running inside the current elongation .
Parameters
- fetchProperties object optional
- tabId numeral optional
Chrome 54+
Find a scene according to a yellow journalism idaho. If this field is omitted, returns all views .
- character ViewType optional The type of view to get. If omitted, returns all views ( including background pages and tab ). valid values : ‘tab ‘, ‘notification ‘, ‘popup ‘ .
- windowId act optional The window to restrict the research to. If omitted, returns all views .
- tabId numeral optional
Returns
- Window array of global objects
isAllowedFileSchemeAccess
chrome.extension.isAllowedFileSchemeAccess(
callback?:
function
,
)
Promise
Retrieves the state of the extension ‘s access to the ‘file : // ‘ scheme. This corresponds to the user-controlled per-extension ‘Allow access to File URLs ‘ set accessible via the chrome : //extensions page .
Parameters
- recall function optional The
callback
argument looks like :(isAllowedAccess: boolean) => void
- isAllowedAccess boolean true if the elongation can access the ‘file : // ‘ scheme, false differently .
Returns
- Promise
Pending
This merely returns a
Promise
when thecallback
argument is not specified, and with MV3+. The type inside thePromise
is the same as the 1st argument tocallback
.
isAllowedIncognitoAccess
chrome.extension.isAllowedIncognitoAccess(
callback?:
function
,
)
Promise
Retrieves the department of state of the extension ‘s access to Incognito-mode. This corresponds to the user-controlled per-extension ‘Allowed in Incognito ‘ mise en scene accessible via the chrome : //extensions foliate .
Parameters
- recall function optional The
callback
parameter looks like :(isAllowedAccess: boolean) => void
- isAllowedAccess boolean true if the extension has access to Incognito mode, false differently .
Returns
- Promise
Pending
This alone returns a
Promise
when thecallback
parameter is not specified, and with MV3+. The type inside thePromise
is the same as the 1st argument tocallback
.
sendRequest
chrome.extension.sendRequest(
extensionId?:
string
,
request:
any
,
callback?:
function
,
)
Promise
≤MV2
Deprecated
Please practice runtime.sendMessage
. Sends a single request to other listeners within the extension. similar to runtime.connect
, but only sends a single request with an optional response. The extension.onRequest
event is fired in each page of the extension .
Parameters
- extensionId string optional The extension ID of the elongation you want to connect to. If omitted, default option is your own elongation .
- request any
- recall function optional
Pending
The
callback
parameter looks like :(response: any) => void
- response any The JSON response object sent by the coach of the request. If an error occurs while connecting to the propagation, the recall will be called with no arguments and
runtime.lastError
will be set to the error message .
- response any The JSON response object sent by the coach of the request. If an error occurs while connecting to the propagation, the recall will be called with no arguments and
Returns
- Promise
Pending
This only returns a
Promise
when thecallback
parameter is not specified, and with MV3+. The character inside thePromise
is the like as the 1st argumentation tocallback
.
chrome.extension.setUpdateUrlData(
data:
string
,
)
Sets the value of the ap CGI parameter used in the annex ‘s update URL. This respect is ignored for extensions that are hosted in the Chrome Extension Gallery .
Parameters
- string