BusinessModel

BusinessModel ⇐ Model

Kind: global class
Extends: Model
Model:
Properties

NameTypeDefaultDescription
idstring

the business model id

isObservableboolean
isBusinessModelboolean
data*

represents the native data returns by the third party library the service is tied on

$$fromCachebooleanfalse

Model is retrieved from cache

$$maxAgeNumber-1

Duration in milliseconds before invalidation of cache (if -1, cache will never get invalidated and 0 will never add to cache)

BusinessModel()

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,
   }
});