> For the complete documentation index, see [llms.txt](https://book.tml.ink/app-development/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.tml.ink/app-development/frontend-solution/localstorgae.md).

# localstorgae

The Storage interface of the Web Storage API provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items.

To manipulate, for instance, the read data for storage, a call to the TML.bag.Out() is made; whereas for write data the call is made to TML.bag.In().

## TML.bag.Out()

When passed a key name and a default value, this method will return that key's value in the storage.

```javascript
TML.bag.Out("token","default value");
```

## TML.bag.In()

When passed a key name and value, will add that key to the storage, or update that key's value if it already exists.

```javascript
TML.bag.In("nickName","tim");
```

## TML.bag.No()

When passed a key name, will remove that key from the local storage.

```javascript
TML.bag.No("nickName");
```

## Default Local Storage of Build-in

### Prefix of Data

In order to separate data from multiple applications on the same server, add a prefix to the database, field, namespace, and so on.

```javascript
TML.bag._
```

### WebSocket Address

Get the address of the WebSocket server of the current app connection.

```javascript
TML.bag.wss
```

### Token

The token of login user:

```javascript
TML.bag.Out("token")
```

### User ID

The id of login user:

```javascript
TML.bag.id
```

or

```javascript
TML.bag.Out("id")
```
