Provides access to Cloud Storage capabilities.

// Check out Persistent Cloud Storage example in the Asset Library

const cloudStorageOptions = CloudStorageOptions.create();

script.cloudStorageModule.getCloudStore(
cloudStorageOptions,
onCloudStoreReady,
onError
);

function onCloudStoreReady(store) {

// Write
const writeOptions = CloudStorageWriteOptions.create();
writeOptions.scope = StorageScope.User;

store.setValue(
"myKey",
"myValue",
writeOptions,
function onSuccess() {
print("Stored Succesfully!");

// List
const listOptions = CloudStorageListOptions.create();
listOptions.scope = StorageScope.User;

store.listValues(
listOptions,
function(results, cursor) {
// Results are returned as a list of [key, value] tuples
for (var i = 0; i < results.length; ++i) {
var key = results[i][0];
var value = results[i][1];
print(' - key: ' + key + ' value: ' + value);
}
},
onError
);

},
onError
);
}

function onError(code, message) {
print('Error: ' + code + ' ' + message);
}

Hierarchy (View Summary, Expand)

Constructors

Properties

name: string

The name of the Asset in Lens Studio.

uniqueIdentifier: string

Methods

  • Get the Cloud Store. Future calls to this method will return the same cloud store, even if the options change.

    Parameters

    Returns void

  • Returns the name of this object's type.

    Returns string

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

MMNEPVFCICPMFPCPTTAAATR