-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
54 lines (37 loc) · 1.13 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: pageAction.isShown()
slug: Mozilla/Add-ons/WebExtensions/API/pageAction/isShown
---
{{AddonSidebar}}
Renvoie `true` si l'action de la page est affichée pour l'onglet donné..
C'est une fonction asynchrone qui renvoie une [`Promise`](/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise).
## Syntaxe
```js
let gettingIsShown = browser.pageAction.isShown(
details, // object
);
```
### Paramètres
- `details`
- : `object`. Un objet contenant le `tabId` à vérifier.
- `tabId`
- : `integer`. ID de l'onglet à vérifier.
### Valeur retournée
Une [`Promise`](/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise) qui sera remplie avec `true` si l'action de page de l'extension est affichée pour l'onglet donné, et `false` dans le cas contraire.
## Compatibilité des navigateurs
{{Compat}}
## Exemples
Vérifiez l'état de l'onglet actuellement actif :
```js
async function shownInActiveTab() {
let tabs = await browser.tabs.query({
currentWindow: true,
active: true,
});
let shown = await browser.pageAction.isShown({
tabId: tabs[0].id,
});
console.log(shown);
}
```
{{WebExtExamples}}