15,907,492 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 12737957 (Top 13 by date)
Member 12737957
20-Jan-17 2:28am
View
Deleted
function asynchronousFunction1() {
return new Promise(
function (resolve, reject) {
//result can be any value we want to pass
resolve(result);
//it will be rejected if some error occurs
reject(error);
});
}
and we can call this function from anywhere like:
asynchronousFunction1()
.then(result{
//here the resul comes depends on what send through promise
})
.catch(error{
//Here i can handle the error
});
so, lets have a simple function in javascript to call multiple asynchrous functions:
function toCallAsyncFunctions(){
Promise.all([
asynchronousFunction1(),
asynchronousFunction2(),
asynchronousFunction3(),
asynchronousFunction4() // you can call further more
])
.then(([result1, result2 ,result3 ,result4]) {
//just sumup here all the results coming from all asynchronous functions
var sum = (result1+result2+result3+result4);
})
.catch(err {
console.log("error:",err);
});
}
and define all functions outside that function:
function asynchronousFunction1() {
return new Promise(
function (resolve, reject) {
resolve(result1);
reject(error);
});
}
function asynchronousFunction2() {
return new Promise(
function (resolve, reject) {
resolve(result2);
reject(error);
});
}
function asynchronousFunction3() {
return new Promise(
function (resolve, reject) {
resolve(result3);
reject(error);
});
}
function asynchronousFunction4() {
return new Promise(
function (resolve, reject) {
resolve(result4);
reject(error);
});
}
Member 12737957
19-Jan-17 12:00pm
View
I have problem with understanding async functions and promises and callbacks, thats the core... i read some articles but didnt quite understand them
Member 12737957
19-Jan-17 11:56am
View
I have problem with understanding async functions and promises and callbacks, thats the core... i read some articles but didnt quite understand them
Member 12737957
19-Jan-17 11:50am
View
I think that i did not apply good... Its overall confusing
Member 12737957
19-Jan-17 11:42am
View
That's a imposter. I put on some forum that I would pay if someone does it so that's not my mom its a fraud. Now I tried to do that by myself and I need help
Member 12737957
19-Jan-17 11:38am
View
No, I am not. Maybe we have the same homework
Member 12737957
27-Dec-16 8:50am
View
I have sprites, have css, but cannot reproduce it. How would you write div tag?
Member 12737957
27-Dec-16 8:43am
View
I don't want to have folder with million of .png files. I created one sprite file with css classes and I want to use them as html tag to take emoji from css class wiht <div class='emoji emoji-">bla bla
Member 12737957
27-Dec-16 8:27am
View
Yeah, I've been there, but i still don't know how to change that html tag that takes emoji from sprite ...
Member 12737957
4-Nov-16 3:21am
View
Could you write me that part of code? And where to put it?
Member 12737957
3-Nov-16 16:04pm
View
But how to put changes to the code that ifs updated, it not copies info from facebook?
Member 12737957
13-Sep-16 15:46pm
View
it's framework7. That's what I want. That intro-button done becomes exactly like arrow-next. But I don't know how. When I use font awesome, it's not the same arrow, it's thicker ...
Member 12737957
13-Sep-16 15:02pm
View
Ok, but I want when the last slide appears, that DONE becomes the same as next-arrow. on that same place and the same size...like it's not the end of the slide and than that next-arrow goes to login url
Show More