FAQ Database Discussion Community


How can i access field annotations in traceur atscript

ecmascript-6,traceur
// Options: --annotations --array-comprehension --async-functions --debug --debug-names --exponentiation --free-variable-checker --generator-comprehension --low-resolution-source-map --input-source-map --member-variables --module-name --referrer --require --script --symbols --types --validate //annotation class class Template{ value:string; constructor(value:string){ this.value = value; } } //annotation class class Attribute{} @Template('<div>xxx</div>') class SomeEl{ @Attribute counter:int=0; constructor(){} } (function...

ES6 - how to test Jasime tests thru karma using ES6 like 'import' statement

jasmine,karma-runner,browserify,traceur,gulp-karma
I am new to javascript, trying to write a spec having an ES6 like import statement and then execute it thru Karma with pre-processors as traceur and browserify (to bundle and provide 'require' method). It continues to give me an error of invalid syntax and on looking at the specs...

ECMAScript 6: what is WeakSet for?

javascript,ecmascript-6,traceur
The WeakSet is supposed to store elements by weak reference. That is, if an object is not referenced by anything else, it should be cleaned from the WeakSet. I have written the following test: var weakset = new WeakSet(), numbers = [1, 2, 3]; weakset.add(numbers); weakset.add({name: "Charlie"}); console.log(weakset); numbers =...

How to use gulp-traceur and gulp-webpack?

javascript,gulp,ecmascript-6,traceur
I'm trying to compile ES6 js files. I use gulp-traceur and gulp-wepback in gulp pipe line. gulp.task('default', function () { return gulp.src('js/app.js') .pipe(traceur()) .pipe(webpack()) .pipe(concat('app.js')) .pipe(rename({suffix: '.min'})) .pipe(uglify()) .pipe(gulp.dest('build/js')); When running gulp. I take error: Unexpected reserved word. You may need an appropriate loader to handle this file type. On...

What is the correct (spec-wise) behavior of `yield* undefined` & `yield undefined` in ES6?

yield,ecmascript-6,babeljs,traceur
While trying to understand how to work with KoaJS (question), I came to realize that yield* undefined behaves differently between babel & traceur. Babel seem to ignore the statement, while traceur throws an exception. A sample can be seen here: Babel - Traceur. I tried looking it up in the...

Nested ES6 classes?

ecmascript-6,traceur
It seems possible to nest a class in a constructor which can then be instantiated from anywhere within the class, is this official? [EDIT] E.g., class C { constructor() { class D { constructor() { } } } method() { var a = new D(); // works fine } }...

How to test an ES6 generator function from an ES5 test framework

ecmascript-6,traceur
Given an ES6 class with generator function how do you run that generator function from ES5 code: class GeneratorClass { constructor() { this.ary = [1, 2, 3]; } *[Symbol.iterator]() { for (let el of this.ary) { yield el; } } } // This runs fine transcompiled (traceur) var iterableObj =...

Override a setter, and the getter must also be overridden

ecmascript-6,traceur
class AbstractClass { constructor() { } set property(value) { this.property_ = value; } get property() { return this.property_; } } class Subclass extends AbstractClass { constructor() { super(); } set property(value) { super.property = value; if (!(this.property_ instanceof SubclassAssociatedClass)) throw new TypeError(); } //get property() { // return super.property; //}...

Generating both browserify output & System.register() modules from ES6 modules?

browserify,ecmascript-6,babeljs,traceur,systemjs
I have coded ES6 modules as per 2ality's final syntax example, without a .js suffix. I have as well organised the modules into a vendor/project directory hierarchy and module naming scheme as System.register() module format effectively places registered modules into the same namespace. The problem is as follows, if I...