Title here
Summary here
Model
Kind: global class
Extends: Model
Model:
Properties
Name | Type | Default | Description |
---|---|---|---|
id | string | the business model id | |
isObservable | boolean | ||
isBusinessModel | boolean | ||
data | * | represents the native data returns by the third party library the service is tied on | |
$$fromCache | boolean | false | Model is retrieved from cache |
$$maxAge | Number | -1 | Duration in milliseconds before invalidation of cache (if -1, cache will never get invalidated and 0 will never add to cache) |
A BusinessModel
is a model that is returned by a service.
The native data (data
property) returned by the third party can be of any javascript type.
It is up to the vendor implementation to map the native data properties with the Model’s ones
$BusinessModel.declare("AbstractContent", {
properties: {
isContent: true,
title: null,
description: null,
parentalRating: null,
rating: 0,
poster: null
}
});
$AbstractEpisode.declare("ImplementationEpisode", {
properties: {
id: ({data}) => data.id,
title: ({data}) => data.title,
description: ({data}) => data.synopsis,
parentalRating: ({data}) => data.moralityLevel,
rating: ({data}) => data.customerRating,
poster: ({data}) => ((data.images || []).find((image)=> image.type === "majaqh") || {}).url,
}
});