Promises is just the object returned by the function - whether it is a method or not, it does not matter. Try the following:
class Something {
promiseMethod () {
return new Promise(...);
}
}
(new Something).promiseMethod().then(...)
But maybe you didn’t have to call a method and be able to use Promise methods directly? In this case, this is not a method, this property:
class Something {
constructor () {
this.promiseProperty = new Promise(...);
}
}
(new Something).promiseProperty.then(...);
source
share