The Ember.js Times - Issue #40
Pẹlẹ o Emberistas!

This week we have so much news around new exciting RFCs for you that it was hard for us to even keep up! But we still tried our best to give you a good summary of what cool features might be landing in your favorite framework in the future. 

We also have shining news for your favorite dev tool - the Ember Inspector - and another fresh Readers’ Question about easy module imports for you this week. 🐹
Ember comes with a great deal of tools to get a job done right out of the box. Most of the time you don’t have to look too far, like the tools on your tool belt, to find the right function or helper that comes as part of the framework. However, like most things in life, these tools need improvements or upgrades to match the ever-changing day-to-day challenges. This week’s RFCs (Request for Comments) aim to add or enhance some of your most used tools.

Array functions: All things Ember.A() without the Ember.A(). Ember makes working with arrays a breeze. mapBy, rejectBy, pushObject, uniq, the list goes on. These helpful Array methods make for a good developer experience, but they do come at a cost. If Array prototype extensions are disabled (as is the case in FastBoot) it becomes frustrating to defensively wrap every Array in Ember.A(). Additionally, these methods are wastefully added to the global Array prototype when only a handful of them are ever used. RFC#323 proposes that all Array methods are extracted and exported as similarly named functions. For example, instead of using Array.mapBy(prop), you would use the mirrored function mapBy(array, prop)

On the surface the drawbacks to such an approach would be an increase in Ember’s framework size, but since the conversion is nearly one-to-one, the increase should be negligible. 

Array helper: @mmun has finished up the RFC for an array template helper. This RFC proposes a new template helper for dynamically creating Arrays in templates. The usage is similar to the hash template helper and helps fill in a hole in the Ember Template API.

Objects (hashes) and Arrays are the two very common data structures in JavaScript, so having an array helper in addition to the existing hash helper makes sense for Ember.

An example usage of this helper in a template is: (array 'a' 'b' 'c') which would return the value ['a', 'b', 'c'].

Today there are existing addons which supply this helper as part of their suite: ember-composable-helpers and ember-array-helper. This RFC will allow these implementations to be deprecated.

All in all, this is a great addition to the Ember API. While it will add a minuscule size increase to the framework, the hole that it fills makes up for it.

Html-Safe-Helper: Sometimes you need to consume html to display it in a template. What if that html contained script tags or a malicious iframe? To use this type of content, it’s best to run it through the htmlSafe function to create a SafeString. This work is usually done outside of the template, and without a framework provided helper, so you would create a component that is otherwise unnecessary. Moreover, you could install ember-cli-string-helpers. RFC#319 encourages the adoption of a framework provided html-safe helper. The RFC already has strong support with a majority of the conversation focusing on the naming of the helper and if the triple curlies should be deprecated.

Key functions for each / each-in: The Glimmer VM uses a diffing algorithm to determine when to re-render a loop. The default key strategy used in the algorithm is usually good enough in most cases to detect when a loop has changed. RFC#321 enhances change detection by augmenting the default key strategies with user defined functions. This increased flexibility allows you to assemble composite keys from many different properties of an object or even from properties on objects whose fields are out of your control.

At this point we would like to remind you that the RFC process is a workflow doing just what its name says: asking for comments of the community, also know as you. ❤️Check out any of the RFCs we mentioned above and let your opinion, suggestions and thoughts be heard.
Are you a writer at heart and do you also love Ember? If you’re writing blog posts or if you’re getting into writing on the web, check out the ember tag of the Frontend Weekly and get your Ember-related articles featured on their site. You can submit any posts of yours to emad@frontendweekly.co to get them published on their curated list of Ember articles.

Still feeling a bit timid about blogging in general or you simply don’t know where to start? Pop by the #team-learning Slack channel to ask about and discuss Ember-related topics that might become the theme of your next post and join others in writing about Ember! ✍️✨

And pssst...just in case you haven’t joined the Emberista crowd on Slack yet, you definitely should. Get your invite to the channel right here.
This week we have another great Readers’ Question for you that you might have asked yourself lots of times already before when trying to bring your favorite JavaScript library to your Ember App: When will we be able to just use the ES6 import syntax to include NPM packages, regardless of the type of module system (e.g. CommonJS or AMD) that this library is using?

Ember CLI team member @kellyselden will talk about his current efforts to bring that miracle import to Ember apps of the future. You can read his full answer to this question on the official Ember forum via the button below.
Read Full Answer
Got a question for the Ember team yourself? Submit your own questions at bit.ly/ask-ember-core! We will answer one of your questions in another edition of the Ember.js Times.
Ember Inspector: Component Tree and Modernization
The Ember Inspector crew has been hard at work modernizing our dev tools experience to be cutting edge and compete with the features and aesthetics enjoyed in other frameworks’ dev tools. The first step towards this was the introduction of a component tree, which removes the table view we are used to, and just shows a tree of your Ember components alongside the properties that belong to that component. 

This is a very early iteration, and styles and functionality will continue to improve, but we are excited for the direction things are going in and wanted to thank @bestra and @nummi for spearheading this effort! 💪

You can check out their work here and also meet with the Ember Inspector crew on Slack at #ember-inspector.
✨ That's another wrap!  ✨ 

Be kind,
Alon Bukai, Richard Wagner, Amy Lam, Ryan Mark, Melanie Sumner, Ricardo Mendes, Jessica Jordan and the Learning Team
Until the next issue, happy Embering :)
The Ember.js Learning Team · 812 SW Washington St, Ste 1000 · Portland OR 97205 · USA
Unsubscribe | View in browser