Goal
I would like to write a javascript library (framework), but need OOP and mixins.
Was giving a go to typescript, but it doesn't support mixins (the handbook says it does, but the compiler/specifications has nothing that is mixin related).
Typescript
In typescript, the following code:
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
Compiles to:
var Greeter = (function () {
function Greeter(message) {
this.greeting = message;
}
Greeter.prototype.greet = function () {
return "Hello, " + this.greeting;
};
return Greeter;
})();
Then clients can simply call:
var greeter = new Greeter("world");
Dart
Can dart do something similar? Can someone show how?
The main goal is that the produced javascript code is readable, preferably with all the dart extras residing in a different script.
I've seen this question and this answer, but neither seem to yield a readable JS file, like in the typescript example above.