Skip to content

Latest commit

 

History

History
225 lines (125 loc) · 3.74 KB

permissions.rst

File metadata and controls

225 lines (125 loc) · 3.74 KB

≡ permissions API

permissions API

.. rst-class:: api-main-section

Functions

contains(permissions)

.. api-section-annotation-hack::

Check if the extension has the given permissions.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``permissions``
      :type: (:ref:`permissions.AnyPermissions`)


.. api-header::
   :label: Return type (`Promise`_)


   .. api-member::
      :type: boolean


   .. _Promise: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

getAll()

.. api-section-annotation-hack::

Get a list of all the extension's permissions.

.. api-header::
   :label: Return type (`Promise`_)


   .. api-member::
      :type: :ref:`permissions.AnyPermissions`


   .. _Promise: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

remove(permissions)

.. api-section-annotation-hack::

Relinquish the given permissions.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``permissions``
      :type: (:ref:`permissions.Permissions`)


request(permissions)

.. api-section-annotation-hack::

Request the given permissions.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``permissions``
      :type: (:ref:`permissions.Permissions`)


.. api-header::
   :label: Return type (`Promise`_)


   .. api-member::
      :type: boolean


   .. _Promise: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

.. rst-class:: api-main-section

Events

onAdded

.. api-section-annotation-hack::

Fired when the extension acquires new permissions.

.. api-header::
   :label: Parameters for onAdded.addListener(listener)


   .. api-member::
      :name: ``listener(permissions)``

      A function that will be called when this event occurs.


.. api-header::
   :label: Parameters passed to the listener function


   .. api-member::
      :name: ``permissions``
      :type: (:ref:`permissions.Permissions`)


onRemoved

.. api-section-annotation-hack::

Fired when permissions are removed from the extension.

.. api-header::
   :label: Parameters for onRemoved.addListener(listener)


   .. api-member::
      :name: ``listener(permissions)``

      A function that will be called when this event occurs.


.. api-header::
   :label: Parameters passed to the listener function


   .. api-member::
      :name: ``permissions``
      :type: (:ref:`permissions.Permissions`)


.. rst-class:: api-main-section

Types

AnyPermissions

.. api-section-annotation-hack::

.. api-header::
   :label: object


   .. api-member::
      :name: [``origins``]
      :type: (array of :ref:`permissions.MatchPattern`, optional)


   .. api-member::
      :name: [``permissions``]
      :type: (array of :ref:`permissions.Permission`, optional)


Permissions

.. api-section-annotation-hack::

.. api-header::
   :label: object


   .. api-member::
      :name: [``origins``]
      :type: (array of :ref:`permissions.MatchPattern`, optional)


   .. api-member::
      :name: [``permissions``]
      :type: (array of :ref:`permissions.OptionalPermission`, optional)