Coder Social home page Coder Social logo

Comments (11)

gordonkristan avatar gordonkristan commented on June 16, 2024 6

@bartocc Yes, you must use the old-style anonymous function, not the arrow functions. Arrow functions, by definition, are bound to their lexical scope and the scope cannot be changed. If you need to access this in your property, an arrow function simply won't work.

from ember-cli-babel.

rwjblue avatar rwjblue commented on June 16, 2024

I believe that the transpilation is correct. At the time that the Ember.computed(()=>{}) bit is processed this is the module scope (which is undefined due to being in "use strict" mode). Ember ensures that the computed is called with the correct this context, no () => { } is needed here.

from ember-cli-babel.

sivakumar-kailasam avatar sivakumar-kailasam commented on June 16, 2024

@rwjblue My bad. Played around the interactive babel editor and understood how the transpilation works in this and few more cases 😄

from ember-cli-babel.

stefanpenner avatar stefanpenner commented on June 16, 2024

as soon as the spec settles, we will get/enable annotations, which will likely unlock the following syntax

class Foo extends Ember.Object {
  @dependsOn('firstName', 'lastName')
  get fullName() {
    ...
  }
}

this gives us the nice concise syntax we crave

from ember-cli-babel.

sivakumar-kailasam avatar sivakumar-kailasam commented on June 16, 2024

yeah can't wait for that to be out 😄 feels more natural.

from ember-cli-babel.

stefanpenner avatar stefanpenner commented on June 16, 2024

ya, we are working to nail down some of the other semantics, but hopefully soon :)

from ember-cli-babel.

bartocc avatar bartocc commented on June 16, 2024

@rwjblue when you say "no () => { } is needed here", do you mean we MUST use "function() {}" instead or is there another way ?

from ember-cli-babel.

bartocc avatar bartocc commented on June 16, 2024

@sivakumar-kailasam I'd be interested to know if you managed to have computed properties work with fat arrow functions in the end

from ember-cli-babel.

sivakumar-kailasam avatar sivakumar-kailasam commented on June 16, 2024

@bartocc I didn't. I'm planning to use @rwjblue's ember-computed-decorators which is a step towards what @stefanpenner had mentioned

from ember-cli-babel.

bartocc avatar bartocc commented on June 16, 2024

Thx guys. things are clear now ;-)

from ember-cli-babel.

SathishkumarThangavel avatar SathishkumarThangavel commented on June 16, 2024

does this problem solved now?

from ember-cli-babel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.