Class Helper
publicDefined in: | packages/ember-glimmer/lib/helper.ts:12 |
---|---|
Module: | @ember/component |
Since: | v1.13.0 |
compute (params, hash) public
Module: | @ember/component |
---|
Defined in packages/ember-glimmer/lib/helper.ts:93
Available since v1.13.0
- params
- Array
- The positional arguments to the helper
- hash
- Object
- The named arguments to the helper
Override this function when writing a class-based helper.
recompute public
Module: | @ember/component |
---|
Defined in packages/ember-glimmer/lib/helper.ts:62
Available since v1.13.0
On a class-based helper, it may be useful to force a recomputation of that helpers value. This is akin to rerender
on a component.
For example, this component will rerender when the currentUser
on a session service changes:
email.js
import Helper from '@ember/component/helper' import { inject as service } from '@ember/service' import { observer } from '@ember/object' export default Helper.extend({ session: service(), onNewUser: observer('session.currentUser', function() { this.recompute(); }), compute() { return this.get('session.currentUser.email'); } });
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/classes/Helper/methods