Questions tagged [thenable]

6 questions
11
votes
3 answers

PromiseKit 6.13.1 cannot conform to 'Thenable' when I try to use Promise functions

I am finding extremely hard to use PromiseKit 6.13.1 in an apparently simple situation. I have the following two functions returning a Promise but I cannot seem to find a way to use them with ```firstly{}.then{} syntax: func…
Fabrizio Prosperi
  • 1,398
  • 4
  • 18
  • 32
5
votes
3 answers

In JavaScript ES6, how can a thenable accept resolve and reject?

I think one principle I take so far is: A promise is a thenable object, and so it takes the message then, or in other words, some code can invoke the then method on this object, which is part of the interface, with a fulfillment handler, which is…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
3
votes
1 answer

error message Uncaught (in promise) , but I can't find what's wrong with that after add catch function

Why does added catch still not work at all? function maxRequest(url = ``, times = 3) { // closure function autoRetry (url, times) { console.log('times = ', times); times--; return new Promise((resolve, reject) => { …
xgqfrms
  • 10,077
  • 1
  • 69
  • 68
1
vote
1 answer

Await Execution of a Subcommand and Parse its Output

I'm attempting to run a command line tool and parse the output from stdout in order to do something useful with it in a VSCode extension. I'm attempting to create Flow objects (defined elsewhere in the code) and append them to this.flows; however,…
0
votes
2 answers

How does this promise without an argument work in this mutation observer?

I was looking at this mutation obersver in some typescript code and I can’t figure how the promise works in it, I’ve not see a promise without an argument in this style before: const observer = new MutationObserver((mutations: MutationRecord[]) =>…
CafeHey
  • 5,699
  • 19
  • 82
  • 145
0
votes
1 answer

Is it true that the JavaScript ES6 promise has a standard procedure for then() to chain several time-consuming promises with asynchronous tasks?

I think the short version of the question is: if the fulfillment handler supplied to a .then() returns a new promise, how does this new promise "unwrap" to the promise returned by .then()? (unwrap seems like a terminology used in the promise…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740