Is it possible or possible in the future to return a value from an ES6 class's getter via ES2017's await/async functions.
class Foo { async get bar() { var result = await someAsyncOperation(); return result; } } function someAsyncOperation() { return new Promise(function(resolve) { setTimeout(function() { resolve('baz'); }, 1000); }); } var foo = new Foo(); foo.bar.should.equal('baz');
Update:As others have pointed out, this doesn't really work. @kuboon provided a nice solutionbelow.
You can do this
This is the same as the code below