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
3
votes
1 answer

Dynamic Service Locator In JavaScript?

I'm trying to get a dynamic service locator written in JavaScript using Harmony Proxies (Node.js). Basically you would create a new container: var container = new Container(); You would then be able to set and get values like a traditional service…
Daniel
  • 1,692
  • 2
  • 13
  • 19
3
votes
2 answers

Is there any current proposal I can follow about adding proper locale support to JavaScript?

Even though all major operating systems and programming languages/APIs have had locale support for at least a couple of decades, it seems that JavaScript still does not! With JavaScript becoming more and more of a full application programming…
hippietrail
  • 15,848
  • 18
  • 99
  • 158
2
votes
1 answer

Why does `enable-javascript-harmony` prevent StackOverflows in Web Workers?

I have some code compiled from Ocaml to Javascript using js_of_ocaml. Now, when moving that code to work in a Web Worker thread, I started to get StackOverflows. However, when I run the code on the main thread, or if I enable…
2
votes
1 answer

Harmony destructuring ReferenceError: Invalid left-hand side in assignment

This a weird behaviour, i've tested on Chrome and works just fine without any flag, but in node it doesn't work event with the latest version $ node --harmony_destructuring app.js [length, offset] = this.getint(data, offset, 2) ^ …
norman784
  • 2,201
  • 3
  • 24
  • 31
2
votes
2 answers

How to access scope variable in ES6 styled Angular Controller?

I switched to using ES6 (Babel) in my new Angular project. ES6 classes cannot have variables. How do I set my $scope variable now?? Say I have a simple controller: class MainController { constructor ($timeout, events) { 'ngInject'; …
2
votes
0 answers

Watch an object properties

I am looking for a cross-browser method allowing me to define callbacks each time a javascript object's property is created/deleted/modified. This should allow me to do things this way: var myObject = {}; function onSet(propertyName, propertyValue)…
2
votes
1 answer

Why does this throw an error in Node.js with --harmony?

In Chrome Canary and Node.js 0.12.3, the following code prints p. 'use strict'; let o = { name: 'o', foo: function() { ['1'].map(function() { console.log(this.name); }.bind(this)); }, }; let p = { name:…
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
2
votes
1 answer

Difference between simple import statement and System.import in ES6 Module Loader

Is anybody able to explain the difference between a simple import and a System.import statement of the ES6 Module Loader (or Polyfills like System.js, Webpack etc.) Something like System.import('https://code.jquery.com/jquery.js').then(); seems to…
2
votes
0 answers

What are the differences between module loading in ES6, AMD, and CommonJS?

I'd like to learn more about the differences between the following, with special attention to compatibility issues (different browsers, minification, etc), performance, and readability/maintainability. ES6: export and export default syntax, paired…
2
votes
1 answer

~~ Operator Javascript

I came across this operator preceding a 'this' keyword in some Node.js Harmony code, specifically working with the Koa web framework. The example code is below: app.use(function *(){ var n = ~~this.cookies.get('view') + 1; …
2
votes
1 answer

Synchronously load a module whose name is determined at runtime in ES6

With CommonJS, require calls are synchronous, one can easily load a module dynamically like this: require('./' + localModulePath); ES6 introduces System.import which returns a Promise, and the standard import seems to not allow names that are…
0x8890
  • 515
  • 1
  • 4
  • 12
2
votes
1 answer

ES6 Class is not a function when imported via System

how come Game is not a function when imported via System import Core from 'gameUnits/Core' export class Game { constructor() { core: export class Core { constructor(scene) { } } etc and in the browser:
SuperUberDuper
  • 9,242
  • 9
  • 39
  • 72
2
votes
1 answer

How will ECMAScript 6 Harmony modules be managed in HTML script tags?

I realize this is not yet implemented and so hypothetical. When ES6 Harmony modules are eventually implemented in modern browsers how will the syntax and implementation handle inline JavaScript? By comparison I can imagine the conceptual distinction…
Sukima
  • 9,965
  • 3
  • 46
  • 60
2
votes
2 answers

EcmaScript 6 Map() vs new Map()

To create a map in ES6, should you say Map() or new Map()? Both seem to work fine in node --harmony. The draft spec says "The Map constructor is the %Map% intrinsic object and the initial value of the Map property of the global object. When Map is…
rwallace
  • 31,405
  • 40
  • 123
  • 242
2
votes
1 answer

Precedence of yield in EcmaScript 6

I have a function build that synchronously returns an object, that in turn contains a function run. This function returns a thunk and hence can be called using yield and a library such as co. Basically the call looks like this: yield…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425