Comments (11)
@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.
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.
@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.
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.
yeah can't wait for that to be out 😄 feels more natural.
from ember-cli-babel.
ya, we are working to nail down some of the other semantics, but hopefully soon :)
from ember-cli-babel.
@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.
@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.
@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.
Thx guys. things are clear now ;-)
from ember-cli-babel.
does this problem solved now?
from ember-cli-babel.
Related Issues (20)
- Needs bump for TS v4.5 `import type` support
- hovering when lack of open curly brace HOT 2
- Optional Chaining in delete statement removes delete statement HOT 2
- deprecate is not available from `@ember/debug` pre 4.0.0 HOT 21
- Private property transpilation broken w/ externalHelpers enabled
- Cannot build Ember on ARM64 HOT 1
- `useBabelConfig` on fresh ember-app doesn't work HOT 1
- `Could not find module '@babel/runtime/helpers/esm/regeneratorRuntime'` in a fresh new app HOT 1
- Is there a way to opt out of ember-cli-babel entirely?
- Error: Decorating class property failed. Please ensure that proposal-class-properties is enabled and runs after the decorators transform. HOT 2
- [QUEST] v8 Release HOT 15
- Ember is undefined HOT 3
- Potential Security Vulnerabilities Detected in Package
- ember-cli-babel@8 breaks parallelization
- Remove the "class-properties" and "private-methods" plugins HOT 2
- `includeExternalHelpers` breaks parallel builds
- Missing information about compatibility for v8
- Option for enabling `onlyRemoveTypeImports` HOT 1
- JSON5 vulnerability in v7.x of ember-cli-babel HOT 3
- Please ensure that transform-class-properties
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-babel.