Questions tagged [ecmascript-harmony]

ECMAScript Harmony is the code name for proposals aiming to extend the current ECMA-262 specification.

ECMAScript Harmony is the code name for proposals aiming to extend the current ECMA-262 specification and to form the new . It names the agreed design trajectory of post-ES5 editions. It will include syntactic extensions, but the changes will be more modest than ECMAScript 4 in both semantic and syntactic innovation.

Packages, namespaces, and early binding from ECMAScript 4 are no longer included for planned releases, and don't live under the roof of Harmony.

References

  1. ECMAScript - Wikipedia
  2. ECMAScriptHarmony - ECMAScript.org
239 questions
1
vote
1 answer

What is the difference between function and function*

What is the difference between generator functions created with function and function* function a(i){ for(;i>0;i--){ yield i*i; } } function *b(i){ for(;i>0;i--){ yield i*i*i; } }
KOLANICH
  • 2,904
  • 2
  • 20
  • 20
1
vote
2 answers

Harmony proxy, detect whether property was accessed or called

Is there a way using Proxy to detect if a property was executed, or was it just accessed? 'use strict'; require('harmony-reflect'); var Stub = { method: function (a) { console.log('q' + a + this.q); } }; var ProxiedLibrary = { …
Misiur
  • 5,019
  • 8
  • 38
  • 54
1
vote
1 answer

Why does Object.observe() not provide the data path of change to a callback?

The changes array of an Object.observe() callback contains objects with the following four properties: name object type oldValue https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe#Parameters Why isn't…
CodeManX
  • 11,159
  • 5
  • 49
  • 70
1
vote
1 answer

For-of loop in node --harmony doesn't work with arrays

When I start node v0.11.14 REPL with --harmony option and try for-of loop, I get: > for (var i of [3, 4, 5]) console.log(i); TypeError: undefined is not a function The same for sets. But it works fine with generators: > function* Counter() { var…
Thaumant
  • 2,113
  • 2
  • 19
  • 14
1
vote
1 answer

Using node.js, nodeunit, and ES6/Harmony

Right now I have a unit testing build environment using node.js and nodeunit. Very happy with these but now I need TCO. I know that TCO has been added into the ES6 standard, but I don't know how to allow it for use with my project. Tried the Harmony…
1
vote
1 answer

Module for ES6 features

Is there a JavaScript module, that can be installed in current versions of Node, that provides some ES6 features e.g. Map? (The version of Map provided by node --harmony doesn't yet implement enough features to be useful.)
rwallace
  • 31,405
  • 40
  • 123
  • 242
1
vote
0 answers

How to yield twice to different functions in JavaScript?

So my code is of the "let's use Generators to avoid Callback Hell" variety. I'm trying to have an accessor function wrap a generator that handles opening IndexedDB. I need to have the generator yield to the "callback", and then yield to the accessor…
1
vote
1 answer

Yield showing syntax error ; is missing in javascript;

I am writing the simple function of generator function simpleGenerator(){ yield "first"; yield "second"; yield "third"; }; var g = simpleGenerator(); console.log(g.next()); it is giving for the line of yield -- SyntaxError: missing ; before…
Ammar Hayder Khan
  • 1,287
  • 4
  • 22
  • 49
1
vote
1 answer

In the ES6 Class below, why does goFast() work?

I'm trying to learn more about ES6 and saw this class in a tutorial. Why does goFast() work without a function keyword in front of it? Is this a new shorthand for functions in classes, or…? class RaceCar extends Car { //inheritance …
Michael Kaufman
  • 683
  • 1
  • 9
  • 19
1
vote
1 answer

How to use --harmony flag in my node app with phusion passenger?

Because our Node.js app need to run the service with koa.js, so the processes need to be started with --harmony flag. Like this. $ node --harmony app.js But how can I configure the passenger to run the app with it?
iwillwen
  • 13
  • 4
1
vote
1 answer

compile node with --harmony-generators on by default

I'm trying to build node v0.11.12-release with the --harmony-generators flag defaulted to always on. I thought I'd be able edit this line to have the value true, but when I do that I get the below error whenever I run node. Extension or internal…
chevett
  • 659
  • 2
  • 7
  • 18
1
vote
2 answers

Is it ever OK to write an NPM module that sets module.exports to a generator function?

If you want to publish a module that has sequenced IO, is it ever OK to write, ./sequenced_actions.js module.exports = function * () {} Thereby permitting something like, co( function * { yield require('./sequenced_actions'); } )();
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
1
vote
1 answer

Destructuring returning undefined variables

I'm trying out the new destructuring feature of ES6, but having some trouble either understanding it, or getting it to work. var test = { testme: "asd", funcA: function() { console.log("A"); } }; var [ testme, funcA ] =…
CodingIntrigue
  • 75,930
  • 30
  • 170
  • 176
1
vote
1 answer

How to use promise in node.js

So, I have an nodejs with promises support: $ node -v v0.11.11 But when I try to use Promises I have an error: $ node --harmony test.js require, module, __filename, __dirname) { var promise = new Promise(fu …
just-boris
  • 9,468
  • 5
  • 48
  • 84
1
vote
1 answer

Why are ES6 Generators preferable to function calls?

I’m still confused at some of the advantages of ES6 Generators. How does, app.use(function *(next){ var start = new Date; yield next; var ms = new Date - start; this.set('X-Response-Time', ms + 'ms'); }); compare to something…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468