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.

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.

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

TML.bag.No()

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

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.

TML.bag._

WebSocket Address

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

TML.bag.wss

Token

The token of login user:

TML.bag.Out("token")

User ID

The id of login user:

TML.bag.id

or

TML.bag.Out("id")

Last updated