Ember Custom Events

published on January 1, 2013 in technical

Lately I have been using Ember.js a lot. I had a problem with firing/listening to events that are not common to Ember.js

1. How you should fix this

Before initializing the Ember application, you should do something like this:

var App = Ember.Application.create({
	customEvents: {
		blur: "blur",
		paste: "paste",
		changed: "changed"
	}
});
App.initialize();

And after that, you may extend an Ember.TextField like this:

App.TextField = Ember.TextField.extend({
	blur: function() {
		"use strict";
		// do something here
	}
});

2. More to come about Ember

Due to me using Ember a lot lately, I will be writing small post about things that I find useful. So if you are curious, then stayed tuned.