Skip to content

Commit

Permalink
Merge pull request #10517 from jonathanKingston/ember-computed-docume…
Browse files Browse the repository at this point in the history
…ntation

[DOC release] Move Ember.computed properties documentation to be it's own namespace. F...
  • Loading branch information
rwjblue committed Feb 24, 2015
2 parents d246e75 + ee7a65e commit bb4ddec
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 70 deletions.
6 changes: 4 additions & 2 deletions packages/ember-metal/lib/computed.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,10 @@ ComputedPropertyPrototype.teardown = function(obj, keyName) {
}.property('firstName', 'lastName')
```
@method computed
@for Ember
@class computed
@namespace Ember
@constructor
@static
@param {String} [dependentKeys*] Optional dependent keys that trigger this computed property.
@param {Function} func The computed property function.
@return {Ember.ComputedProperty} property descriptor instance
Expand Down
80 changes: 40 additions & 40 deletions packages/ember-metal/lib/computed_macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function generateComputedWithProperties(macro) {
```
@since 1.6.0
@method computed.empty
@for Ember
@method empty
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which negate
the original value for property
Expand Down Expand Up @@ -83,8 +83,8 @@ export function empty(dependentKey) {
hamster.get('hasStuff'); // false
```
@method computed.notEmpty
@for Ember
@method notEmpty
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which returns true if
original value for property is not empty.
Expand Down Expand Up @@ -116,8 +116,8 @@ export function notEmpty(dependentKey) {
hamster.get('isHungry'); // true
```
@method computed.none
@for Ember
@method none
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which
returns true if original value for property is null or undefined.
Expand Down Expand Up @@ -146,8 +146,8 @@ export function none(dependentKey) {
user.get('isAnonymous'); // false
```
@method computed.not
@for Ember
@method not
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which returns
inverse of the original value for property
Expand Down Expand Up @@ -178,8 +178,8 @@ export function not(dependentKey) {
hamster.get('hasBananas'); // false
```
@method computed.bool
@for Ember
@method bool
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which converts
to boolean the original value for property
Expand Down Expand Up @@ -211,8 +211,8 @@ export function bool(dependentKey) {
user.get('hasValidEmail'); // true
```
@method computed.match
@for Ember
@method match
@for Ember.computed
@param {String} dependentKey
@param {RegExp} regexp
@return {Ember.ComputedProperty} computed property which match
Expand Down Expand Up @@ -246,8 +246,8 @@ export function match(dependentKey, regexp) {
hamster.get('napTime'); // false
```
@method computed.equal
@for Ember
@method equal
@for Ember.computed
@param {String} dependentKey
@param {String|Number|Object} value
@return {Ember.ComputedProperty} computed property which returns true if
Expand Down Expand Up @@ -279,8 +279,8 @@ export function equal(dependentKey, value) {
hamster.get('hasTooManyBananas'); // true
```
@method computed.gt
@for Ember
@method gt
@for Ember.computed
@param {String} dependentKey
@param {Number} value
@return {Ember.ComputedProperty} computed property which returns true if
Expand Down Expand Up @@ -312,8 +312,8 @@ export function gt(dependentKey, value) {
hamster.get('hasTooManyBananas'); // true
```
@method computed.gte
@for Ember
@method gte
@for Ember.computed
@param {String} dependentKey
@param {Number} value
@return {Ember.ComputedProperty} computed property which returns true if
Expand Down Expand Up @@ -345,8 +345,8 @@ export function gte(dependentKey, value) {
hamster.get('needsMoreBananas'); // true
```
@method computed.lt
@for Ember
@method lt
@for Ember.computed
@param {String} dependentKey
@param {Number} value
@return {Ember.ComputedProperty} computed property which returns true if
Expand Down Expand Up @@ -378,8 +378,8 @@ export function lt(dependentKey, value) {
hamster.get('needsMoreBananas'); // true
```
@method computed.lte
@for Ember
@method lte
@for Ember.computed
@param {String} dependentKey
@param {Number} value
@return {Ember.ComputedProperty} computed property which returns true if
Expand Down Expand Up @@ -413,8 +413,8 @@ export function lte(dependentKey, value) {
hamster.get('readyForCamp'); // 'Yes'
```
@method computed.and
@for Ember
@method and
@for Ember.computed
@param {String} dependentKey*
@return {Ember.ComputedProperty} computed property which performs
a logical `and` on the values of all the original values for properties.
Expand Down Expand Up @@ -450,8 +450,8 @@ export var and = generateComputedWithProperties(function(properties) {
hamster.get('readyForRain'); // 'Yes'
```
@method computed.or
@for Ember
@method or
@for Ember.computed
@param {String} dependentKey*
@return {Ember.ComputedProperty} computed property which performs
a logical `or` on the values of all the original values for properties.
Expand Down Expand Up @@ -483,8 +483,8 @@ export var or = generateComputedWithProperties(function(properties) {
hamster.get('hasClothes'); // 'Hawaiian Shirt'
```
@method computed.any
@for Ember
@method any
@for Ember.computed
@param {String} dependentKey*
@return {Ember.ComputedProperty} computed property which returns
the first truthy value of given list of properties.
Expand Down Expand Up @@ -518,8 +518,8 @@ export var any = generateComputedWithProperties(function(properties) {
hamster.get('clothes'); // ['Camp Hat', 'Camp Shirt']
```
@method computed.collect
@for Ember
@method collect
@for Ember.computed
@param {String} dependentKey*
@return {Ember.ComputedProperty} computed property which maps
values of all passed in properties to an array.
Expand Down Expand Up @@ -558,8 +558,8 @@ export var collect = generateComputedWithProperties(function(properties) {
alex.get('name'); // '@machty'
```
@method computed.alias
@for Ember
@method alias
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which creates an
alias to the original value for property.
Expand Down Expand Up @@ -591,8 +591,8 @@ export var collect = generateComputedWithProperties(function(properties) {
teddy.get('firstName'); // 'Teddy'
```
@method computed.oneWay
@for Ember
@method oneWay
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which creates a
one way computed property to the original value for property.
Expand Down Expand Up @@ -639,8 +639,8 @@ export function oneWay(dependentKey) {
teddy.get('firstName'); // 'Teddy'
```
@method computed.readOnly
@for Ember
@method readOnly
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which creates a
one way computed property to the original value for property.
Expand Down Expand Up @@ -670,8 +670,8 @@ export function readOnly(dependentKey) {
hamster.get('favoriteFood'); // 'Banana'
```
@method computed.defaultTo
@for Ember
@method defaultTo
@for Ember.computed
@param {String} defaultPath
@return {Ember.ComputedProperty} computed property which acts like
a standard getter and setter, but defaults to the value from `defaultPath`.
Expand All @@ -694,8 +694,8 @@ export function defaultTo(defaultPath) {
though they were called on the original property, but also
print a deprecation warning.
@method computed.deprecatingAlias
@for Ember
@method deprecatingAlias
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computed property which creates an
alias with a deprecation to the original value for property.
Expand Down
56 changes: 28 additions & 28 deletions packages/ember-runtime/lib/computed/reduce_computed_macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ var a_slice = [].slice;
A computed property that returns the sum of the value
in the dependent array.
@method computed.sum
@for Ember
@method sum
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computes the sum of all values in the dependentKey's array
@since 1.4.0
Expand Down Expand Up @@ -76,8 +76,8 @@ export function sum(dependentKey) {
lordByron.get('maxChildAge'); // 8
```
@method computed.max
@for Ember
@method max
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computes the largest value in the dependentKey's array
*/
Expand Down Expand Up @@ -125,8 +125,8 @@ export function max(dependentKey) {
lordByron.get('minChildAge'); // 5
```
@method computed.min
@for Ember
@method min
@for Ember.computed
@param {String} dependentKey
@return {Ember.ComputedProperty} computes the smallest value in the dependentKey's array
*/
Expand Down Expand Up @@ -173,8 +173,8 @@ export function min(dependentKey) {
hamster.get('excitingChores'); // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
```
@method computed.map
@for Ember
@method map
@for Ember.computed
@param {String} dependentKey
@param {Function} callback
@return {Ember.ComputedProperty} an array mapped via the callback
Expand Down Expand Up @@ -218,8 +218,8 @@ export function map(dependentKey, callback) {
lordByron.get('childAges'); // [7, 5, 8]
```
@method computed.mapBy
@for Ember
@method mapBy
@for Ember.computed
@param {String} dependentKey
@param {String} propertyKey
@return {Ember.ComputedProperty} an array mapped to the specified key
Expand All @@ -230,8 +230,8 @@ export function mapBy(dependentKey, propertyKey) {
}

/**
@method computed.mapProperty
@for Ember
@method mapProperty
@for Ember.computed
@deprecated Use `Ember.computed.mapBy` instead
@param dependentKey
@param propertyKey
Expand Down Expand Up @@ -268,8 +268,8 @@ export var mapProperty = mapBy;
hamster.get('remainingChores'); // [{name: 'write more unit tests', done: false}]
```
@method computed.filter
@for Ember
@method filter
@for Ember.computed
@param {String} dependentKey
@param {Function} callback
@return {Ember.ComputedProperty} the filtered array
Expand Down Expand Up @@ -324,8 +324,8 @@ export function filter(dependentKey, callback) {
hamster.get('remainingChores'); // [{ name: 'write more unit tests', done: false }]
```
@method computed.filterBy
@for Ember
@method filterBy
@for Ember.computed
@param {String} dependentKey
@param {String} propertyKey
@param {*} value
Expand All @@ -348,8 +348,8 @@ export function filterBy(dependentKey, propertyKey, value) {
}

/**
@method computed.filterProperty
@for Ember
@method filterProperty
@for Ember.computed
@param dependentKey
@param propertyKey
@param value
Expand Down Expand Up @@ -380,8 +380,8 @@ export var filterProperty = filterBy;
hamster.get('uniqueFruits'); // ['banana', 'grape', 'kale']
```
@method computed.uniq
@for Ember
@method uniq
@for Ember.computed
@param {String} propertyKey*
@return {Ember.ComputedProperty} computes a new array with all the
unique elements from the dependent array
Expand Down Expand Up @@ -424,8 +424,8 @@ export function uniq() {
/**
Alias for [Ember.computed.uniq](/api/#method_computed_uniq).
@method computed.union
@for Ember
@method union
@for Ember.computed
@param {String} propertyKey*
@return {Ember.ComputedProperty} computes a new array with all the
unique elements from the dependent array
Expand All @@ -448,8 +448,8 @@ export var union = uniq;
obj.get('friendsInCommon'); // ['William King', 'Mary Somerville']
```
@method computed.intersect
@for Ember
@method intersect
@for Ember.computed
@param {String} propertyKey*
@return {Ember.ComputedProperty} computes a new array with all the
duplicated elements from the dependent arrays
Expand Down Expand Up @@ -535,8 +535,8 @@ export function intersect() {
hamster.get('wants'); // ['banana']
```
@method computed.setDiff
@for Ember
@method setDiff
@for Ember.computed
@param {String} setAProperty
@param {String} setBProperty
@return {Ember.ComputedProperty} computes a new array with all the
Expand Down Expand Up @@ -679,8 +679,8 @@ function binarySearch(array, item, low, high) {
todoList.get('priorityTodos'); // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
```
@method computed.sort
@for Ember
@method sort
@for Ember.computed
@param {String} dependentKey
@param {String or Function} sortDefinition a dependent key to an
array of sort properties (add `:desc` to the arrays sort properties to sort descending) or a function to use when sorting
Expand Down

0 comments on commit bb4ddec

Please sign in to comment.