skip to Main Content

Javascript – Callback and Microtask Queue of Java Script

p1 = new Promise((res,rej)=>{ console.log("p1 setTimeout"); setTimeout(()=>{ res(17); }, 10000); }); p2 = new Promise((res,rej)=>{ console.log("p2 setTimeout"); setTimeout(()=>{ res(36); }, 2000); }); function checkIt() { console.log("Started"); let val1 = this.p1; console.log("P1"); val1.then((data)=>{console.log("P1 => "+data)}); let val2 = this.p2; console.log("P2"); val2.then((data)=>{console.log("P2…

VIEW QUESTION

Ubuntu – How to send multiple requests to a server at few milliseconds of interval in C#

I have a code that looks like this: public static async Task<Request> SendRequest(Client client, DateTime startTime, int offset) { TimeSpan timeToWait = startTime - DateTime.UtcNow + TimeSpan.FromMilliseconds(offset); await Task.Delay(timeToWait); Console.Write(offset); Request request = client.sendRequest(); } async static public Task<Request> SendMultiple(Client…

VIEW QUESTION
Back To Top
Search