js-data

Respect Your Data

Give your data the treatment it deserves with a framework-agnostic, datastore-agnostic JavaScript ORM built for ease of use and peace of mind. Works in Node.js and in the Browser.

Get Started

DS#compute

DS#compute(resourceName, instance)

Force the given instance or the item with the given primary key to re-compute its computed properties.

👍

You can call DS#compute multiple ways

  • DS#compute(resourceName, id)
  • Resource#compute(instance) - Where Resource was created by DS#defineResource
  • Instance#DSCompute() - Where Instance is an instance of a Resource

Argument

Type

Description

resourceName

string

The name of the resource to use. Unnecessary if calling compute directly on a Resource.

instance or id

object or string or number

The instance on which to re-computed properties, or the primary key (item must be in the store) of the instance.

Demo

📘

Need help?

Want more examples or have a question? Ask on the Slack channel or post on the mailing list then we'll get your question answered and probably update this wiki.

Updated less than a minute ago

DS#compute


DS#compute(resourceName, instance)

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.