Storage script interface
IStorage interface provides access to storage for the project. It essentially wraps a simple key-value storage engine based on IndexedDB. This means any data that can be stored in IndexedDB can be stored with these methods, such as numbers, strings, Blobs, etc. It is typically accessed by the IRuntime
This interface accesses the same storage as the Local Storage plugin. Therefore an item stored from the event sheet can also be read from script, and vice versa. Note however that Construct expressions can only be strings or numbers, so if a script stores a different type it cannot be used in the event sheet.
As with the Local Storage plugin, the storage is unique to the specific project. It is not shared with any other projects or other website storage, even on the same origin.
Read an item from storage. Returns a promise that resolves to the value of the item if it exists in storage, else
null if the item does not exist in storage.
async setItem(key, value)
Write an item to storage. Returns a promise that resolves when the write has completed.
Delete an item from storage. Returns a promise that resolves when the removal has completed.
Delete all items from storage. Returns a promise that resolves when the clear has completed.
Retrieve a list of all keys in storage. Returns a promise that resolves to an array of key names.
Construct 3 Manual
You are here:
Search this manual:
This manual entry was last updated on 23 Oct, 2019 at 19:08