Posts

Showing posts with the label promise

Tyson Fury promises to drop showboat antics and be ‘all business’ in Belfast against Francesco Pianeta on August 18

Image
TYSON FURY has promised to drop the “showboating” and return to being “all business” next month against Francesco Pianeta. The Gypsy King continues his attempt to climb back into the world title frame when he faces the Italian at Windsor Park in Belfast on August 18. Pacemaker Press Tyson Fury has promised to be 'all business' in his next fight AFP Tyson Fury was heavily criticised for his showboating against Sefer Seferi in June Former heavyweight king Fury made his long-awaited comeback against Sefer Seferi in June and decided to play up to the audience – even landing a kiss on the former cruiserweight before the first bell. The showboating did not end there, with the 29-year-old continuing his antics before the Albanian was stopped in the fourth round. But Fury has been told to cut it out and take a more serious approach for his next showdown by trainer Ben Davison – and that advice seems to have been taken on board. Fury said: “We saw the joker in the last camp, we saw th...

recursion with Promises

recursion with Promises I have a collection in MongoDB like this [ { "classId": "1", "name": "Input", "definition": [ { "property": [ { "classId": "12", "name": "One" }, { "classId": "8", "name": "Comment" } ] } ] }, { "classId": "8", "name": "CommentDetail", "definition": [ { "property": [ { "classId": "10", "name": "user" }, { "classId": "10", "name": "message" } ] } ] }, { "classId": "10", "name": ...

How can I call a function with promise?

How can I call a function with promise? Here is my code: var gblink = require('./getbloglinks'); new Promise(function (resolve, reject) { var getLinks = gblink.getBlogLinks("www.example.com"); resolve(getLinks); }).then(function (data) { console.log("here"); console.log(data); return false; }) gblink.getBlogLinks() is a function which gets a URL and returns all links in that page (after a short time) . When I run my code, immediately console.log("here"); will be printed and then console.log(data); will be printed as undefined . gblink.getBlogLinks() console.log("here"); console.log(data); undefined Anyway how can I make that promise waiting until the result of getBlogLinks() returns? getBlogLinks() Noted that when I call gblink.getBlogLinks() function manually, it works as well, it just takes a while and all I need to do now is implementing a waiting system for that function. gblink.getBlogLinks() Here is gbl...

Javascript difference between promise in function and var equal to promise

Javascript difference between promise in function and var equal to promise I am trying to work on some promises and I'm a bit confused on the difference between the below 2 ways of using promises: First method: function myfunction() { return new Promise((resolve, reject) => { // do stuff }); } second method: var myfunction = new Promise((resolve, reject) => { // do stuff }); What is the difference between these two? Is there preference on when to use one or the other? One is a promise, the other is a function. You use the promise when you need a promise, and you use the function when you need a function. they aren't directly interchangeable. – Kevin B 2 days ago No. One is a promise, the other will create and return a promise if/when it is called. ...