Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: consider using ES10 sugar syntax #33

Open
eviltik opened this issue Mar 20, 2022 · 0 comments
Open

change: consider using ES10 sugar syntax #33

eviltik opened this issue Mar 20, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@eviltik
Copy link
Collaborator

eviltik commented Mar 20, 2022

1. Support classes: private, static & public members

Current syntax, we can't really define private / public methods/getter/setter/variable : everything is public.

class foo {
    constructor() {
        this.bar = true;
    }
}

The refactor will consist to separate public and private things, i.e

class foo {
   
    // private variable
    #foo_private= "bar_public";

    // public variable
    foo_public = "foo_public";

    constructor() {
        // modify private variable
        this.#foo_private = "bar2_private";
    
        // modify public variable
        this.foo_public = "bar2_public";

        // run a private method
        this.#myPrivateMethod();

        // run a public method
        this.myPublicMethod();
    }

    // private method
    #myPrivateMethod() {
    }

    // public method
    myPublicMethod() {
    }
}

2. Support classes: extend

Rather than something which is not currently used in all branches (i.e Prototype add/replace methods/variables, we should use something like this :

class CanvasText extends CanvasWidget {
}

3. Support classes: picking object notation

Rather than

let property;
if (object) {
    property = (typeof object.attribute != undefined) ? object.attribute : defaultValue;
}

We can (note the question mark)

const property = (typeof object?.attribute !== undefined) ? object.attribute : defaultValue;

4. All "Panels" (i.e Widget) should be a class

Not only ColorPicker, Keyboard, Slider ...

We should have Text, Button, Image

@eviltik eviltik added the enhancement New feature or request label Mar 20, 2022
@eviltik eviltik added this to the short term milestone Mar 20, 2022
@eviltik eviltik self-assigned this Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant