Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ember NYC - RFC Roundup

Ember NYC - RFC Roundup

As part of Ember NYC's RFC Roundup meetup, I shared the following Ember RFCs:
- RFC 459: Angle Bracket Invocation for Built-in Components
- RFC 470: {{fn}} Helper
- RFC 471: {{on}} Helper

Kevin Pfefferle

April 25, 2019
Tweet

More Decks by Kevin Pfefferle

Other Decks in Technology

Transcript

  1. {{link-to}} • Uses positional arguments as the main API:
 


    {{#link-to "route"}}Link Text{{/link-to}} • Supports an inline form:
 
 {{link-to "Link Text" "route"}}
  2. {{input}} •Internally implemented as several components •Selected based on type

    argument
 
 {{input type="text" value=model.name}}
  3. {{fn}} Helper <button {{action "increment" 5}}>Click</button>
 <button {{action this.increment 5}}>Click</button>


    <button onclick={{action "increment" 5}}>Click</button>
 <button onclick={{action this.increment 5}}>Click</button>
 <button {{action (action "increment" 5)}}>Click</button>
 <button {{action (action this.increment 5)}}>Click</button>
 
 <button onclick={{fn this.increment 5}}>Click</button>
 <button {{on "click" (fn this.increment 5)}}>Click</button>
  4. {{fn}} Helper <button {{action (mut showModal) true}}>Click</button>
 <button onclick={{action (mut

    showModal) true}}>Click</button>
 <button {{action (action (mut showModal) true)}}>Click</button>
 
 <button onclick={{fn (mut showModal) true}}>Click</button>
 <button {{on "click" (fn (mut showModal) true)}}>Click</button>
  5. {{action}} Modifier •Uses non-standard AST transform to pass this •Binds

    to the click event by default •Confused with @action decorator and
 {{action}} helper
  6. on* Properties •Bind to element properties =
 not SSR/rehydration friendly

    •Not all events are bindable via on* •Do not work at all for elements like <svg> •Not compatible with standard web components
  7. {{on}} Modifier <div {{on "click" this.handleClick passive=true}}>
 </div>
 
 


    element.addEventListener(
 'click',
 this.handleClick,
 { passive: true }
 );