import intersect from 'ember-composable-helpers/addon/helpers/intersect';
import { helper } from 'reactiveweb/helper';
class Demo {
@tracked listA = [...];
@tracked listB = [...]
intersection = helper(this, intersect, () => [this.listA, this.listB])
toString = (array) => array.join(', ');
}
{{this.toString this.intersection.value}}
implemented with raw
invokeHelper
API, no classes fromember-resources
used.Enables the use of template-helpers in JavaScript
Note that it should be preferred to use regular functions in javascript whenever possible, as the runtime cost of "things as resources" is non-0. For example, if using
@ember/component/helper
utilities, it's a common p practice to split the actual behavior from the framework constructso in this case
plainJs
can be used separately.This differentiation makes less of a difference since plain functions as helpers will be supported soon.