Git Product home page Git Product logo

ecmascript-runtime's Introduction

ecmascript-runtime Build Status

Polyfills for new ECMAScript 2015 APIs like Map and Set

ecmascript-runtime's People

Contributors

benjamn avatar mbrobbel avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ecmascript-runtime's Issues

getters not working with inheritance

This is most likely an issue w/ Babel, and may be related to this issue, but I wanted to post this to see if someone might be able to help me.

Say I have the following classes defined:

A = class A {
    constructor(value, options) {
        this.value = value;
        this.options = options;
        console.log('constructor this: ', this);
    }

    get value() {
        return this._value;
    }

    set value(value) {
        this._value = value;
    }

    get options() {
        return this._options;
    }

    set options(options) {
        this._options = options;
    }

    get validationErrors() {
        // Do standard validations for all classes of type A here
        console.log('A.validationErrors this: ', this);
        var validationErrs = [];
        if (options && options.required && !value) {
            validationErrs.push('Value is required');
        }

        return validationErrs;
    }
}

B = class B extends A {
    get validationErrors() {
        console.log('B.validationErrors this: ', this);
        var valErrs = super.validationErrors;
        // Do custom validations for class B here
        return valErrs;
    }
}

var b = new B('val', {required: true});
var valErrs = b.validationErrors;

Strangely, what I see in the logs is:

constructor this: B{_value: "val", _options: {required: true}}
B.validationErrors this: B{_value: "val", _options: {requried: true}}
A.validationErrors this: A{}

Furthermore, if I call this.value or this.options in the parent's validationErrors, I end up with undefined returned. It seems like the constructor and getters are being copied down, at least in behavior, but they shouldn't be, right? I would think that the child's constructor would simply call the parent's in this case, but that doesn't seem to be happening.

Problem with let in safari

Hi, im having some trouble with transpiling my code to ES5. When i build with --production flag my meteor application it runs OK on chrome and firefox, but when i run it on safari it returns this error:
"SyntaxError: Cannot declare a let variable twice: 'e'."
In this place of the code ( which is some meteor code )
image

I know this error is a bug already reported from safari, but my question is: the let statement is a ES2015 feature, why is it not being transpiled to a var?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.