Here is my taxonomy of animals that deal with asynchronous code. As you’ve realized, openDatabase()
is the third type and must return a Promise
as you have declared it to. The crucial next step is to instinctively write return
as the very first word of it, which will guide you naturally to write the rest. getHistory()
is also going to be of type three, so its return value also needs to be changed to a Promise
, and it must also again begin with return
.
1 Like