Skip to content

VM Code SDK v2 / getData

Function: getData()

getData(key?): JSONObject

Retrieves data from the session store using the specified key.

Parameters

key?: any

The key for the data to retrieve.

Returns

JSONObject

The data associated with the key, or the entire data store if no key is provided.

Remarks

This function fetches the value associated with the provided key from the session's data store. If no key is provided, it returns the entire data store.

Example

typescript
const bar = 'Hello World';
setData('foo', bar);
const data = getData('foo');
console.log(data); // Outputs: 'Hello World'