Ember stop deprecating!


#1

I just installed a fresh copy of ember and im getting this : DEPRECATION: Using Ember.HTMLBars.makeBoundHelper is deprecated. Please refactor to using Ember.Helper or Ember.Helper.helper. [deprecation id: ember-htmlbars.make-bound-helper] . This is getting really annoying, every tutorial i follow something is deprecated. I have been trying to learn ember for a week now and it’s turning out to be a difficult task… I’ll keep trying but im starting to loose my patience with ember.

Anyone knows how to fix this ? The error message says Please refactor to using Ember.Helper or Ember.Helper.helper. [deprecation id: ember-htmlbars.make-bound-helper]

i typed ember.helper in the terminal and nothing happened… im not sure what i should do…


#2

Hey phpboot, I understand your frustration, been through this myself :smile: This is how you define a helper in Ember 2:

Ember.Helper.helper('ifEquals', function (params, hash) {
	return params[0] === params[1];
});

#3

It’s just being deprecated for future major versions, you don’t have to do anything about it unless you always want to be with the latest and greatest.

You can turn off deprecation warnings if you want to, but just remember that before you can upgrade to a new major version you will need to modify your deprecated code.


#4

You just need to update the ember data to the latest version(1.13.9), to do so, update the bower.json file and run bower update.


#5

Deprecation is a good thing. It means they have found a better way to do things - and they give you plenty of warning and time to amend your code in the version cycle.

I’ve also been frustrated with the out of date tutorials and documentation, but the only thing you can do is try to be part of the solution. No one is getting paid to do any of that stuff. ( Plus trying to learn Ember for 1 week - is really no time at all. ) I think you are losing your patience in general and not just with Ember.

I’m 6 months or more in - and no expert, but I refactored my helpers like this:

for helpers/i-con.js

import Ember from "ember";

export function iCon(value) {
  return Ember.String.htmlSafe("<svg class='icon-x'><use xlink:href='#icon-" + value + "'></use></svg>");
}

export default Ember.Helper.helper(iCon);

In an Ember CLI context. Maybe that will help you. I just had to plug and play until it worked. I think they actually updated that in the docs (I’ve notice some updates in there recently) http://emberjs.com/api/classes/Ember.Helper.html#method_helper

You could also be seeing those errors because some add-ons - or components or other things are using their helpers and haven’t updated yet.

Before a week ago - we had to update these helpers a few times between handle-bars and html-bars and for other reasons - so - Either stick with a version for a while, or try and see it as some growing pains / they are painful - but not as painful as when Angular ripped out half their code… : )