Function

Module: @ember/object
import { collect } from '@ember/object/computed';
dependentKey
String
returns
Ember.ComputedProperty
computed property which maps values of all passed in properties to an array.

A computed property that returns the array of values for the provided dependent properties.

Example

1
2
3
4
5
6
7
8
9
10
let Hamster = Ember.Object.extend({
  clothes: Ember.computed.collect('hat', 'shirt')
});

let hamster = Hamster.create();

hamster.get('clothes'); // [null, null]
hamster.set('hat', 'Camp Hat');
hamster.set('shirt', 'Camp Shirt');
hamster.get('clothes'); // ['Camp Hat', 'Camp Shirt']