# Native Data Store

{% tabs %}
{% tab title="Plain Javascript" %}
{% code overflow="wrap" %}

```javascript
const { setAppData, getAppData, deleteAppData, setCloudData, getCloudData, deleteCloudData } = window.WTN.NativeDatastore;

//Store in the app data -> Locally

setAppData({
  keyName: "your key",
  value: "value to store",
  callback: (response) => {
    console.log("Data saved:", response);
  }
});

getAppData({
  keyName: "your key",
  callback: (response) => {
    console.log("Data retrieved:", response);
  }
});

deleteAppData({
  keyName: "your key",
  callback: (response) => {
    console.log("Data deleted:", response);
  }
});

//Store in the cloud -> Cloud storage

setCloudData({
  keyName: "your key",
  value: "value to store",
  callback: (response) => {
    console.log("Cloud data saved:", response);
  }
});

getCloudData({
  keyName: "your key",
  callback: (response) => {
    console.log("Cloud data retrieved:", response);
  }
});

deleteCloudData({
  keyName: "your key",
  callback: (response) => {
    console.log("Cloud data deleted:", response);
  }
});
```

{% endcode %}
{% endtab %}

{% tab title="ES5+" %}
{% code overflow="wrap" fullWidth="false" %}

```javascript
import { setAppData, getAppData, deleteAppData, setCloudData, getCloudData, deleteCloudData } from "webtonative/NativeDatastore";

//Store in the app data -> Locally

setAppData({
  keyName: "your key",
  value: "value to store",
  callback: (response) => {
    console.log("Data saved:", response);
  }
});

getAppData({
  keyName: "your key",
  callback: (response) => {
    console.log("Data retrieved:", response);
  }
});

deleteAppData({
  keyName: "your key",
  callback: (response) => {
    console.log("Data deleted:", response);
  }
});

//Store in the cloud -> Cloud storage

setCloudData({
  keyName: "your key",
  value: "value to store",
  callback: (response) => {
    console.log("Cloud data saved:", response);
  }
});

getCloudData({
  keyName: "your key",
  callback: (response) => {
    console.log("Cloud data retrieved:", response);
  }
});

deleteCloudData({
  keyName: "your key",
  callback: (response) => {
    console.log("Cloud data deleted:", response);
  }
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

While setting the data supported data types are string, object, array

Feature taken live on 04/09/25


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webtonative.com/javascript-apis/native-data-store.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
