Extends
Members
foreignKey :string
Foreign key in the model tree.
Type:
- string
id :string
- Inherited From:
System-wide unique identifier
Type:
- string
imageUrl :string
- Inherited From:
string containing thumbnail URL
Type:
- string
name :string
- Inherited From:
Product or model name
Type:
- string
price :string
Pricing information.
Type:
- string
tags :Array.<string>
- Inherited From:
tags describing the object
Type:
- Array.<string>
type :string
Type of the model.
Type:
- string
version :number
Version of the locally stored resource. Should be a UNIX timestamp.
Type:
- number
Methods
(async) download(listener) → {Promise}
Downloads all model assets.
Parameters:
Name | Type | Description |
---|---|---|
listener |
function | null | optional progress listener |
Returns:
- Type
- Promise
(async) downloadDescription() → {Promise}
Downloads app-specific data (e.g. textual description, translations, gallery images, etc.).
Returns:
- Type
- Promise
getDescription(…language, fallbackToDescriptionopt)
Get translated description from external data. Accepts several language keys as parameters.
The first found language will be returned.
Keep in mind to download the whole model (Model#download) or just the description (Model#downloadDescription) first.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
language |
string |
<repeatable> |
The language key (e.g. 'en'). |
|
fallbackToDescription |
boolean |
<optional> |
false
|
Use description as fallback if no translation is found. |
hasAllTags(tags) → {boolean}
- Inherited From:
Checks if the object has all of the provided tags. The object may have more tags than that.
Parameters:
Name | Type | Description |
---|---|---|
tags |
Array.<string> |
Returns:
- Type
- boolean
hasAnyTag(tags) → {boolean}
- Inherited From:
Checks if the object has any of the provided tags.
Parameters:
Name | Type | Description |
---|---|---|
tags |
Array.<string> |
Returns:
- Type
- boolean
hasExactTags(tags) → {boolean}
- Inherited From:
Checks if the object has exactly the provided tags, no more or less.
Parameters:
Name | Type | Description |
---|---|---|
tags |
Array.<string> |
Returns:
- Type
- boolean
(async) update() → {Promise}
Looks for newer model version, invalidating its assets if found. Does not actually download assets.
Works only if the model hasn't been instantiated yet.
Throws:
-
if model has already been instantiated
- Type
- Error
Returns:
- Type
- Promise