A little less publicised aspect of Aurelia is the UI Virtualisation plugin. For those accustomed to ReactJS’s speed of rendering large amounts of items in the DOM and offering high paint performance, this will be a welcome plugin to use.
Although, do not be mistaken. The Aurelia UI Virtualization plugin is not meant to replace React, nor give you the same power that it offers. This is not a plugin for a virtual DOM, at least not at the time of writing this. For that, you will need to integrate and use React or an alternative.
When it comes to using a plain old event listener in your Aurelia applications, if you are not aware of how classes work and how things get transpiled, then you will most likely run into some issues working with events and scope.
First you might try something like the following:
export MyClass { attached() { document.addEventListener('click', this.handleBodyClick); } detached() { document.removeEventListener('click', this.handleBodyClick); } handleBodyClick(e) { console.log(e.target); } } On the surface everything looks fine, it should work right? Sorry, but this will not work. Many first timers implementing event listeners into their apps will run into this, heck I even ran into it once as well.
When it comes to ale yeasts, most brewers will not look past the Safale US-05 yeast. As popular as it is, it is still relatively misunderstood in how it works and what the best practice is.
I have been using the US-05 yeast for a long time now as I primarily brew IPA style beers. I always rehydrate my yeast in 110ml of water, the ratio is 10 times the weight of the packet contents in water.
The Event Aggregator is one of my favourite things about Aurelia and it is not even anything unique to Aurelia.
There does not seem to be much info out there about it, probably due to its simplicity. But I have noticed people ask about it in the Gitter chat from time-to-time. At its core the Event Aggregator is a pub/sub layer for publishing and listening to actions that take place inside of your application loosely.
Plain old CSS is boring. If you are building your applications off of the Aurelia Skeleton Navigation then it ships with support for working with regular CSS.
Adding in support for working with Sass in your Aurelia applications is as easy as whistling dixie. We are also going to be adding in support for Autoprefixer as well so we can automatically add in browser prefixes for all of our CSS without worrying about browsers like IE10 and what they can support.
Brewing with extract saves a heap of time and effort if you can’t afford the time and monetary investment in going the all-grain approach. The Coopers extract tins are fantastic, not only that but their website as a range of awesome recipes for using their cans, some even with inclusions of hops and additional cans of malt extract.
If you are new to brewing or perhaps want to improve your kit brews a bit, here is what I have learned. I am definitely not an expert, I am an amateur like you, but I have put down enough of these Cooper’s kits to know what works and what doesn’t.
In Angular 1.x you had the concept of a controller, directive, service, provider and other confusing terms to describe essentially what is one or two things.
What is an Angular service
An Angular service no matter how it was defined is a singleton. Every part of your application gets the same reference when it requests a service or factory.
Angular services in Aurelia
The concept of controllers, services, providers and factories does not exist in Aurelia. Everything is just an ECMAScript 2015 class with hints of future specification features like decorators thrown in for good measure. This works in our favour because porting an Angular service to Aurelia requires very little to no effort.
On a per route basis you might want to configure some additional route specific data that you can access in your view. For example a route might have an icon for your navigation menu. This actually came up in the Aurelia Gitter chatroom and I decided to do a quick little write up.
Say hello to a little unknown property called settings
Added all the way back in February 2015 when Aurelia was still a tiny blip on the Javascript radar was this property which allows you to define an object of additional properties for a route, similar to how Durandal does it.
Update March 2018: Two years on from the original publish date, Aurelia finally has support for server-side rendering.
This means it is now possible to create isomorphic web applications in Aurelia that work with and without Javascript disabled, resulting in faster initial rendering speed. If you would like to see a working example, the Skeleton repo has you covered.
Now, onto the existing article.
Isomorphism is all the rage in the Javascript world. The server can return rendered HTML complete with pre-computation (converting bindings and templating specific events already taken care of increasing initial load speeds and time to paint quite substantially.
If you are like me, you browse Github for cool new repositories. My new hobby is looking at what the community are building for rival frameworks and one of those frameworks is Angular 2.
The Angular 2 community has done a great job of porting over not only existing libraries from Angular 1, but also creating new ones. There are some that are not available for Aurelia, but fortunately there is quite a lot of overlap between the two frameworks in ECMAScript and TypeScript syntax.