Function

Module: @ember/object
import { collect } from '@ember/object/computed';
dependentKey
String
returns
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
11
12
13
14
import { set } from '@ember/object';
import { collect } from '@ember/object/computed';

class Hamster {
  @collect('hat', 'shirt') clothes;
}

let hamster = new Hamster();

hamster.clothes; // [null, null]

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