Open OJezu opened 8 years ago
For now, you could export a factory method instead of class itself:
class Foo {
constructor(foo, bar) {}
static create(foo, bar) {
return new Foo(foo, bar);
}
}
module.exports = Foo.create;
Any idea when will it start supporting ES6 classes ?
If I declare class using es6 class keyword:
And I try to load it using wire:
I get an error:
Wire (actually when) is trying to do
Foo.apply(new_foo, args)
, which is not allowed in es6. Solution would be using new spread operator -new Foo(...args)
, but that is not backwards-compatible. PR #180 has possible workaround with named constructors which can be called with "apply".