Set of methods to operate data storage shared between eitri-apps.

To use SharedStorage and make data available between two or more Eitri-Apps, an AppGroup is required.

AppGroups are a concept that permits some resources to be shared, such as storage. When two or more Eitri-Apps are in the same AppGroup, they can write data in one Eitri-App and retrieve it in another Eitri-App.

To set up an AppGroup configuration, please contact Eitri support.

Data is transmitted as a string and handled with JSON encoding/decoding. Pay attention to the size of the data to avoid affecting the experience.

Hierarchy

  • SharedStorage

Methods

  • Clears all data created by the respective eitri-app from shared storage

    Note:

    This method does not clear other data saved by other eitri-apps

    Example:

    await Eitri.sharedStorage.clear()
    

    Compatibility Control

    • API LEVEL 2 - Functionality added

    Returns Promise<void>

  • Retrieves a stored string from the eitri-app shared storage

    Example:

    const storedValue = await Eitri.sharedStorage.getItem('myData')
    

    Compatibility Control

    • API LEVEL 2 - Functionality added

    Parameters

    • key: string

      Registration key

    Returns Promise<string>

  • Retrieves a stored Object from the eitri-app shared storage

    Example:

    const myObject = await Eitri.sharedStorage.getItemJson('myData')
    

    Parameters

    Returns Promise<any>

  • Retrieves all registration keys stored by the respective eitri-app from shared storage

    Example:

    const myKeys = await Eitri.sharedStorage.keys()
    

    Compatibility Control

    • API LEVEL 2 - Functionality added

    Returns Promise<string[]>

  • Deletes the data associated with the specified key from the eitri-app shared storage

    Example:

    await Eitri.sharedStorage.removeItem('myData')
    

    Compatibility Control

    • API LEVEL 2 - Functionality added

    Parameters

    • key: string

      Registration key

    Returns Promise<void>

  • Stores a string in the eitri-app shared storage

    Example:

    await Eitri.sharedStorage.setItem('myDataKey', "myData")
    

    Parameters

    • key: string

      Key for registration

    • value: string

      Value to be saved

      Compatibility Control

      • API LEVEL 2 - Functionality added

    Returns Promise<void>

  • Stores an Object in the eitri-app shared storage

    Example:

    let myObject = {myData: 'valueOfMyData'}
    await Eitri.sharedStorage.setItemJson('myData', myObject)

    Parameters

    • key: string

      Key for registration

    • value: any

      JSON object to be saved

      Compatibility Control

      • API LEVEL 2 - Functionality added

    Returns Promise<void>

Generated using TypeDoc