Closed betocantu93 closed 4 years ago
The new changes to paper-menu paper-select paper-chips and paper-autocomplete had unnecessary usage of fn helper, the recommended way in octane is just
paper-menu
paper-select
paper-chips
paper-autocomplete
fn
import { action } from '@ember/object'; export default class SomeComponent extends Component { @action open() { //do stuff that needs this component's context this.set('isOpen', true); } calculatePosition(e) { //this function doesn't need component's context e.getBoundingClientRect(); } @action async close(opt) { //This function needs component's context and receives an argument if(opt.id === this.selectedOpt.id) { //whatever return await this.onClose(); } } }
<button {{on "click" this.open}}>Open Stuff </button> {{#if this.isOpen}} <div {{did-insert this.calculatePosition}} ...attributes> <button {{on "click" (fn this.close @opt)}}>Close</button> </div> {{/if}}
Thank you. This makes sense to me now. 👍
The new changes to
paper-menu
paper-select
paper-chips
andpaper-autocomplete
had unnecessary usage offn
helper, the recommended way in octane is just