UFileAPI¶
Implements UFileApi for module script. Holds the deserialized value of the Ufile. The ClientBundle has the serialized value.
- UFileAPI
- .collection
- .value ⇒
* - .raw(username) ⇒
* - .get() ⇒
promise - .set(val) ⇒
Promise
ufile.collection¶
| Type |
|---|
Object.<username, value> |
Collection of all raw values for users having a value for the UFile.
Values format:
{
"fake_id1": {"some-prop":6},
"authenticated_id": {"some-prop":7},
"fake_id2": {"some-prop":1}
}
ufile.value ⇒ *¶
Return value from the UInterface’s load method if defined, otherwise the users raw value for the UFile.
ufile.raw(username) ⇒ *¶
| Param | Type | Description |
|---|---|---|
| username | string | optional |
Returns the current user’s value if no username is given, else returns the given user’s value. Raw value is not passed through load().
ufile.get() ⇒ promise¶
Initiates an async request to refresh the collection of values of this ufile, and returns a Promise. This method is buffered so that calls in quick succession will be combined into a single request.
ufile.set(val) ⇒ Promise¶
| Param | Description |
|---|---|
| val | the new value |
Initiates an async request to update the users value on the server for this ufile. This method is buffered so that calls in quick succession will be combined into a single request.
Returns: Promise -
// Module JS example w/ promise
js.ufile.alias.set('new value').then( ()=>{alert('done')} )