Questions tagged [ecmascript-2016]

Questions about new features specified in the ECMAScript 2016 specification.

This tag targets ECMAScript 2016, a JavaScript standard previously known as ECMAScript 7. Any proposal that reached stage 4 by Jan 28th, 2016 became part of the new version.

These are:

440 questions
17
votes
3 answers

Clean way to keep original variable and destructure at the same time

Is there a cleaner way to do this (with anything that is at least an ES draft and has a babel plugin, i.e., ES6, ES7, etc.): const { a, b } = result = doSomething(); Where I want to keep the overall result as one singular object, but also…
samanime
  • 21,211
  • 7
  • 69
  • 122
16
votes
1 answer

Are the new async and await keywords in ES7 copied from C#?

Noticing that async and await aren't found in Java, where these new keywords in ES7 copied from the C# language? I'm curious as to the origin: Who proposed the keyword names and is someone in the JS community is leveraging concepts from the .NET…
sean2078
  • 4,034
  • 5
  • 29
  • 29
14
votes
3 answers

React passing parameter with arrow function in child component

I have these parent and child component, I want to pass click function to select an item in child component. Yet it seems the function in child component become automatically called instead of waiting until the user click the element. To make it…
Dion Dirza
  • 2,532
  • 2
  • 13
  • 19
13
votes
2 answers

How to support ES7 in ESLint

I have a project setup with WebPack to use ESLint and I'm wanting to use ES7 for the inline bind operator ::. Currently I'm getting the parse errors shown…
Ryan Vice
  • 1,901
  • 3
  • 19
  • 29
13
votes
1 answer

babel ES7 Async - regeneratorRuntime is not defined

I'm using browserify + gulp + babel in my project, and having problem with ES7 features. These are what I installed: babel-plugin-transform-async-to-generator@6.8.0 babel-plugin-transform-decorators-legacy@1.3.4 // for use…
modernator
  • 3,631
  • 11
  • 38
  • 68
13
votes
3 answers

Ability to abort asynchronous call

I'm using babeljs with es7 style async/await methods. I have a main script that will call a async method on an array of objects that all return promises. I use Promise.all() to wait for all of those to return, however, these tasks could take a…
Greg A.
  • 189
  • 1
  • 7
13
votes
1 answer

How jasmine clock works?

I don't want to read code for hours to find the relevant part, but I am curious how jasmine implements its clock. The interesting thing with it is that it can test async code with sync testing code. AFAIK, with the current node.js, which supports…
inf3rno
  • 20,735
  • 9
  • 97
  • 171
12
votes
2 answers

Does ES6 support the Elvis operator?

Does Javascript / ES6 support the Elvis operator? Example: var x = (y==true) ?: 10; Example 2: var debug = true; debug ?: console.log("Value of x:" + x);
1.21 gigawatts
  • 12,773
  • 23
  • 85
  • 187
12
votes
2 answers

TypeScript: class composition

Based on this awesome Composition over Inheritance video by MPJ, I've been trying to formulate composition in TypeScript. I want to compose classes, not objects or factory functions. Here is my effort so far (with a little help from lodash): class…
Glenn Mohammad
  • 2,410
  • 2
  • 24
  • 37
12
votes
1 answer

Check if document exists in mongodb using es7 async/await

I'm trying to check if the user with the email provided exists in the collection users, but my function keeps returning undefined for every call. I use es6 and async/await in order to get rid of lots of callbacks. Here's my function (it is inside of…
Denis Yakovenko
  • 2,398
  • 3
  • 38
  • 70
11
votes
2 answers

ES7, ES8, ES9, ES10 Browser support

It is fairly easy to check out the data about browser support for ECMAScript2015 (ES6), but I found it pretty difficult to have an equivalently clear table for all the following ES versions (ES7 to ES10). Mozilla has some info on their website, it…
Alvin Sartor
  • 1,333
  • 2
  • 14
  • 27
11
votes
2 answers

Circular dependencies in ES6/7

I was surprised to find that in Babel, I could have two modules import each other without any issues. I have found a few places that refer to this as a known and expected behaviour in Babel. I know that this is widely considered an anti-pattern by a…
Andrew
  • 12,936
  • 13
  • 52
  • 102
11
votes
1 answer

Class decorators in ES7

I've been reading up on decorators in JavaScript, and think I'm getting the basic premise. Decorators are functions, they receive as a or several parameters what they should decorate, and return the result. But I came over a @withStyles decorated…
SomeNorwegianGuy
  • 1,292
  • 3
  • 14
  • 38
11
votes
5 answers

react-dnd simple sortable example ES6 instead of ES7

I'm attempting to follow this example: https://github.com/gaearon/react-dnd/tree/master/examples/04%20Sortable/Simple But the code is using ES7 and I don't know how to replace the decorators and the decorate dependency in this…
Recur
  • 1,346
  • 2
  • 15
  • 29
11
votes
2 answers

Using a Decorator to get list of implemented interfaces

Do you know if it is possible to get the array of interfaces implemented by a class using a decorator: interface IWarrior { // ... } interface INinja { // ... } So If I do something like: @somedecorator class Ninja implements INinja, IWarrior…
Remo H. Jansen
  • 17,470
  • 9
  • 63
  • 88
1 2
3
29 30