Ember 1.13 upgradation from Ember 1.0.4

Hello,

I’m upgrading the codes from Ember 1.0.4 to Ember 1.13. When I’m execute the below code using ember 1.13 I’m getting the error

title: Ember.computed('content.title', 'managedObject.isHome', 'managedObject.finalManagedObject', {
                set: function(name, value) {
                    this.set('content.title', value);
                },
                if (this.get('content.title') !== undefined) {
                    return title;
                }
                if (this.get('managedObject') == RSuite.rootNode) {
                    return "Home";
                }
                get: function() {
                  return this.get('managedObject.label') || this.get('managedObject.finalManagedObject.displayName');
                }
            }),

I’m getting the below error while execute the code.

Uncaught SyntaxError: Unexpected token this

Please provide the suggestion.

So it looks like either some lines got a little misplaced or that code is trying to mix two different styles of computed property definitions: “classic” and explicit get/set. With “classic” CPs you pass in a function, with explicit get/set CPs you pass in an object that has two functions, get and set. However in the above code you’re passing in an object with get and set functions but in between them there are a couple if statements.

In short, I think the if statements should be in one of the functions, probably the get

3 Likes