Skip to content

change: consider using ES10 sugar syntax #33

@eviltik

Description

@eviltik

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions