Object responsible for handling models and categories, and communicating with the model repository.
Extends
Members
models :Array.<Model>
Type:
- Array.<Model>
rootCategory :Category
Type:
Methods
(async) downloadAll(handleModelDownloadProgressopt) → {Promise}
- See:
-
- ModelManager#downloadAllProgress.
- ModelManager#stopDownloadAll.
Begins the downloading all model assets assigned to the app. Can be interrupted at any time by calling
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
handleModelDownloadProgress |
function |
<optional> |
optional callback function for model progress (same functionality as event downloadAllProgress). |
Returns:
fulfilled when completed.
- Type
- Promise
(async) fetchCategoryFromRepository(id, timeoutopt) → {Category}
Downloads a category and all it children from the repository.
The category will also be added to the rootCategory.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
string | Category id. |
||
timeout |
number |
<optional> |
10000
|
Set a timeout in ms for the request. |
Returns:
The requested category.
- Type
- Category
(async) fetchModelFromRepository(id) → {Model}
Downloads the full model description to the device's permanent storage.
Once the promise is resolved the model is accessible via getModelById function. Successive calls to this function
will not trigger any further downloads unless the model is updated on the server in the meantime.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | model id |
Returns:
requested model
- Type
- Model
findModelByForeignKey(foreignKey) → {Model}
Retrieves the model with the given foreign key.
Parameters:
Name | Type | Description |
---|---|---|
foreignKey |
string | foreign key of the requested model |
Returns:
requested model if found; null otherwise
- Type
- Model
findModelById(id) → {Model}
Retrieves the model with the given identifier.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | ID of the requested model |
Returns:
requested model if found; null otherwise
- Type
- Model
off(eventName, eventHandler)
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string | |
eventHandler |
function |
on(eventName, eventHandler)
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string | |
eventHandler |
function |
once(eventName, eventHandler)
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string | |
eventHandler |
function |
stopDownloadAll()
Interrupts the process of downloading all model assets.
Events
downloadAllProgress
Fired when a tracking target is found or lost.
Parameters:
Name | Type | Description |
---|---|---|
current |
Number | The index of the model currently downloaded. |
total |
Number | The total amount of models to download. |
progress |
Number | The download progress of the current model in percent between [0, 100]. |
model |
Model | The currently downloaded model object. |
transferProgress
Fired when a tracking target is found or lost.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The transfer id. |
progress |
string | The download progress in percent between [0, 100]. |