A component with positionalParams always also has named versions of its parameters. For example, the liquid-if component from liquid-fire has this in its Javascript file:
So these are equivalent:
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle', | |
| valueList: Ember.A([1, 2, 3, 4]), | |
| updateVal(index, newValue) { | |
| this.valueList.replace(index, 1, newValue); | |
| } | |
| }); |
| import Ember from 'ember'; | |
| const { Component } = Ember; | |
| export default class EachChunk extends Component {}; | |
| EachChunk.tagName = ''; | |
| EachChunk.reopenClass({ | |
| positionalParams: ['items', 'chunkSize'] |
| let writeFile = require('broccoli-file-creator'); | |
| treeForPublic: function() { | |
| const publicTree = this._super.treeForPublic.apply(this, arguments); | |
| const trees = []; | |
| if (publicTree) { | |
| trees.push(publicTree); | |
| } | |
| trees.push(writeFile('the-settings-file.json', this.whateverTheSettingsAre()); |
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| nothing() {} | |
| }); |
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| rows: Ember.computed('names', function() { | |
| let names = this.get('names'); | |
| let columns = Math.floor($(window).width() / 100); | |
| let itemsPerColumn = Math.ceil(names.length / columns); | |
| let rows = []; | |
| for (let rowNumber = 0; rowNumber < itemsPerColumn; rowNumber++) { |
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle' | |
| }); |
Webpack 4 automatically polyfilled many Node APIs in the browser. This was not a great system, because it could lead to surprisingly giant libraries getting pulled into your app by accident, and it gave you no control over the exact versions of the polyfills you were using.
So Webpack 5 removed this functionality. That means you need to make changes if you were relying on those polyfills. This is a quick reference for how to replace the most common patterns.
For each automatically-polyfilled node package name on the left, this shows the name of the NPM package that was used to polyfill it on the right. Under webpack 5 you can manually install these packages and use them via resolve.fallback.
| import Component from '@glimmer/component'; | |
| // This component renders its contents in a shadow root: | |
| // | |
| // <ShadowRoot>stuff</ShadowRoot> | |
| // | |
| // Critically, it renders in a single render pass. The more natural | |
| // modifier-based solutions do not. | |
| // | |
| // The "trick" we're relying on here is the little-known feature that helpers |
| diff --git a/packages/@ember/-internals/glimmer/lib/templates/outlet.ts b/packages/@ember/-internals/glimmer/lib/templates/outlet.ts | |
| index a186b6229..803be2862 100644 | |
| --- a/packages/@ember/-internals/glimmer/lib/templates/outlet.ts | |
| +++ b/packages/@ember/-internals/glimmer/lib/templates/outlet.ts | |
| @@ -1,4 +1,10 @@ | |
| import { precompileTemplate } from '@ember/template-compilation'; | |
| -export default precompileTemplate(`{{component (-outlet)}}`, { | |
| +import { outletHelper } from '../syntax/outlet'; | |
| + | |
| +export default precompileTemplate(`{{component (outletHelper)}}`, { |