Function

collect (dependentKey) Ember.ComputedProperty public

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

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']

© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fobject%2Fcomputed/collect