Category "promise"

What are asynchronous functions in JavaScript? What is "async" and "await" in JavaScript?

This Q&A is aimed to give clear answers to the following questions: What are asynchronous functions in JavaScript and when and how do we use them? What are

Returning Promises from Vuex actions

I recently started migrating things from jQ to a more structured framework being VueJS, and I love it! Conceptually, Vuex has been a bit of a paradigm shift fo

Why does a syntax error occur after restart?

I'm running my little testsite on localhost (although currently there isn't even serverside interaction yet). Everything worked fine until I restarted my PC. O

How to know when all Promises are Resolved in a dynamic "iterable" parameter?

My problem is that I don't know how to know when a dynamic promise array has all the promises resolved. Here an example: var promiseArray = []; promiseArray.p

SequelizeForeignKeyConstraintError on nested findOrCreate inside a loop

I am trying to insert multiple rows on 2 related tables using sequelize with mysql. Based on sequelize transaction cannot insert because of foreign key? I trie

TypeError: res.status is not a function

I'm making a function that permits me to upload a picture to imgur in my express api (nodejs), i'm encoutering an error when calling a function returning a prom

Promises with http.get node.js

Im am doing nodeschool exercises , the This problem is the same as the previous problem (HTTP COLLECT) in that you need to use http.get(). However, this

delay NgModule declaration with async import module

I would like to dynamically import a third-party module and check it. Then declaration in NgModule depends on it exist or not(true/false). Something like my cod

async/await always returns promise

I'm trying async/await functionality. I have such code imitating a request: const getJSON = async () => { const request = () => new Promise((resolve, r

Asynchronous execution of a function App Script

I've been digging around, and I'm not able to find references or documentation on how I can use Asynchronous Functions in Google App Script, I found that people

Use async await with Array.map

Given the following code: var arr = [1,2,3,4,5]; var results: number[] = await arr.map(async (item): Promise<number> => { await callAsynchron

wait for promise before exit process

I'm trying to run a NodeJS code that reads some data fields from an array, use them to do a database query to check if the data is duplicate before inserting th

Using Promises with fs.readFile in a loop

I'm trying to understand why the below promise setups don't work. (Note: I already solved this issue with async.map. But I would like to learn why my attempts

Node.js readline inside of promises

I'm trying to use the node.js package readline to get user input on the command line, and I want to pipe the entered input through promises. However, the input

How to wait for a JavaScript Promise to resolve before resuming function?

I'm doing some unit testing. The test framework loads a page into an iFrame and then runs assertions against that page. Before each test begins, I create a Pro

Return complete array from Promise

I have a function that returns JSON objects using hnews.getById(id). I then push each story returned in the promise to an array. I'm having trouble figuring out