Skip to content

Latest commit

 

History

History
122 lines (68 loc) · 2.28 KB

sessions.rst

File metadata and controls

122 lines (68 loc) · 2.28 KB

≡ sessions API

sessions API

The sessions API allows to add tab related session data to Thunderbird's tabs, which will be restored on app restart.

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

Functions

getTabValue(tabId, key)

.. api-section-annotation-hack::

Retrieve a previously stored value for a given tab, given its key. Returns undefined if the key does not exist.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``tabId``
      :type: (integer)

      ID of the tab whose data you are trying to retrieve. Error is thrown if ID is invalid.


   .. api-member::
      :name: ``key``
      :type: (string)

      Key identifying the particular value to retrieve.


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


   .. api-member::
      :type: string

      This may return undefined


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

removeTabValue(tabId, key)

.. api-section-annotation-hack::

Remove a key/value pair from a given tab.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``tabId``
      :type: (integer)

      ID of the tab whose data you are trying to remove. Error is thrown if ID is invalid.


   .. api-member::
      :name: ``key``
      :type: (string)

      Key identifying the particular value to remove.


setTabValue(tabId, key, value)

.. api-section-annotation-hack::

Store a key/value pair associated with a given tab.

.. api-header::
   :label: Parameters


   .. api-member::
      :name: ``tabId``
      :type: (integer)

      ID of the tab with which you want to associate the data. Error is thrown if ID is invalid.


   .. api-member::
      :name: ``key``
      :type: (string)

      Key that you can later use to retrieve this particular data value.


   .. api-member::
      :name: ``value``
      :type: (string)