Ember 1.13 upgradation

I'm upgrading the code 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') == Core.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

You are using an object to define a computed property. That object must have a get and may have a set function. Both are present. But you have six additional that aren't valid syntax in object definition. You are trying to construct an object like this:

{
  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');
  }
}

The valid part of that object is:

{
  set: function(name, value) {
    this.set('content.title', value);
  },
  get: function() {
    return this.get('managedObject.label') || this.get('managedObject.finalManagedObject.displayName');
  }
}

Depending on your babel configuration you might be able to simplify it to:

{
  set(name, value) {
    this.set('content.title', value);
  },
  get() {
    return this.get('managedObject.label') || this.get('managedObject.finalManagedObject.displayName');
  }
}

I hope it's clear now. This has nothing to do with upgrade from Ember 1.0.4 to Ember 1.13 in particular. Please have in mind that Ember 1.13 is very old. 2.0 was released more than three years ago. So I would strongly recommend to continue migration until you reach at least to 2.18.

Ember 1.13 upgradation, You are using an object to define a computed property. That object must have a get and may have a set function. Both are present. But you have six additional� The Ember Guides and release notes say that “If your app runs on Ember 1.13 without raising deprecations, it should run on 2.0.” And one of my coworkers had already cleaned up deprecations, so

I got the answer by using the below code:

title: Ember.computed('content.title', 'managedObject', 'managedObject.label', 'managedObject.finalManagedObject.displayName', {
                set: function(titleKey, newTitle) {
                    this.set('content.title', newTitle);
                    if (newTitle !== undefined) {
                        return newTitle;
                    } else if (this.get('managedObject') === Core.rootNode) {
                        return 'Home';
                    }
                    return this.get('managedObject.label') || this.get('managedObject.finalManagedObject.displayName');
                },      
                get: function() {
                    var title = this.get('content.title');
                    if (title !== undefined) {
                        return title;
                    } else if (this.get('managedObject') === Core.rootNode) {
                        return 'Home';
                    }
                    return this.get('managedObject.label') || this.get('managedObject.finalManagedObject.displayName');
                }
            }),

Thanks for your suggestions Rinold Simon and jelhan.

Ember 1.13 upgradation from Ember 1.0.4 - Questions, 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:� Install Ember using npm: npm install -g ember-cli While you're at it we recommend you also install PhantomJS to run tests from the command line (without the need for a browser to be open): npm install -g phantomjs To verify that your installation was successful, run: ember -v If you get back something like version: 1.13.0, you're ready to go.

I think the this reference is lost. Try replacing your code with the below one,

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

Ember 1.4.0 to Ember 1.13 Upgradation error - Questions, When I'm execute the below code using ember 1.13 I'm getting the error RenderResult.build = function (env, scope, template, options,� The 1.13 release represents the effort of at least 43 contributors across over 680 commits. Ember 1.13 is the last release in the 1.x series and the first release that includes the Glimmer rendering engine. It includes a number of deprecations that will ease the upgrade to Ember 2.0, which is due to land in six weeks.

Our transition to Ember 1.13, we made to migrate to the latest version of Ember.js: Ember 1.13. Every upgrade has been a smooth process mainly helped by the release� The big news for 1.13 is the Glimmer rendering engine, in that it significantly improves re-render performance and is the result of Ember’s third overhaul of their rendering layer. This is the start of the 2.0 prep, with Glimmer playing a big part in the 2.x series development model.

Ember upgrade from 1.7.0 to 1.13.13, Ember upgrade from 1.7.0 to 1.13.13. October 4, 2016 EmberJS � EmberRelease Obviously there are general upgrade guides provided by Ember team and� Ember 1.13 #5468 ErisDS merged 1 commit into TryGhost : master from jaswilli : ember-1.13 Jun 25, 2015 Conversation 10 Commits 1 Checks 0 Files changed

Ember 1.13 upgradation, I'm upgrading the code 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:� Save 4849 bytes by using my Ember 1.13.0 Zopfli version instead of the best available CDN (3.76% smaller than jsdelivr, 129013 vs. 133862 bytes): Download You can use my super -compressed files for whatever purpose you like as long as you respect the library's original license agreement.

Comments
  • at which line number you are getting error ?
  • if and return inside javascript object? This is something new!
  • I think this is the exact one which even I suggested. But the issue is with why it throws Unexpected token this. Removing the if statements will possibly solve the issue
  • Hi @rinold, I'm getting same issue on this line if (this.get('content.title') !== undefined)
  • at which line are you getting error in your example code ?
  • On the same line of the code which I mentioned in comment before.
  • try removing , which is above if statement
  • Already I have tried before removing ,. Still getting same issues