Ember/5/Fpe Computed
Last update
Jul 24, 2024
Before
import EmberObject from '@ember/object';let Person = EmberObject.extend({init() {this._super(...arguments);this.firstName = 'Betty';this.lastName = 'Jones';},fullName: function () {return `${this.firstName} ${this.lastName}`;}.property('firstName', 'lastName'),});let client = Person.create();client.get('fullName'); // 'Betty Jones'client.set('lastName', 'Fuller');client.get('fullName'); // 'Betty Fuller'
After
import EmberObject, { computed } from '@ember/object';let Person = EmberObject.extend({init() {this._super(...arguments);this.firstName = 'Betty';this.lastName = 'Jones';},fullName: computed('firstName', 'lastName', function () {return `${this.firstName} ${this.lastName}`;}),});let client = Person.create();client.get('fullName'); // 'Betty Jones'client.set('lastName', 'Fuller');client.get('fullName'); // 'Betty Fuller'
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community