Closed cosmicscr closed 7 years ago
Github will not let me leave more comments in the original issue: https://github.com/yortus/asyncawait/issues/48
... so I'm creating a new issue here. The error is "You can't perform that action at this time" when I try to leave a comment. Here is the comment:
To use this asyncawait library with ES6 classes, why not just add the async function to the class prototype? That seems easy and direct:
const async = require('asyncawait/async') const await = require('asyncawait/await') class MyClass { firstMethod() { console.log('firstMethod') } } MyClass.prototype.secondMethod = async(function () {console.log(await('secondMethod'))}) const myClassInstance = new MyClass() console.log(myClassInstance.firstMethod()) myClassInstance.secondMethod().then(function (data) { console.log(data)})``` Output is:
firstMethod secondMethod
Please let me know if I am missing something here.
Figured out the github issue... there is something wrong with my chrome plugins that is blocking me. I updated original issue instead of this one.
Github will not let me leave more comments in the original issue:
https://github.com/yortus/asyncawait/issues/48
... so I'm creating a new issue here. The error is "You can't perform that action at this time" when I try to leave a comment. Here is the comment:
To use this asyncawait library with ES6 classes, why not just add the async function to the class prototype? That seems easy and direct:
firstMethod secondMethod