This is not a core part of ember-resources, but is an example utility to demonstrate a concept when authoring your own resources. However, this utility is still under the broader library's SemVer policy.
A consuming app will not pay for the bytes of this utility unless imported.
implemented with raw invokeHelper API, no classes from ember-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 construct
exportfunctionplainJs() {}
exportdefaulthelper(() =>plainJs())
so in this case plainJs can be used separately.
This differentiation makes less of a difference since
plain functions as helpers
will be supported soon.
This is not a core part of ember-resources, but is an example utility to demonstrate a concept when authoring your own resources. However, this utility is still under the broader library's SemVer policy.
A consuming app will not pay for the bytes of this utility unless imported.
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.
Example