December 2017
Beginner
372 pages
10h 32m
English
Let's assume you have a function which makes a web service call and once the response comes back, we want to process the response and show the data to the user. And all this should be done in an asynchronous way. The following is the code for one such function:
function doWork(clientName: string, callback: (boards: Board[], status: string)=> void): void{ let response:Board[]; // web service call based on id and in response we get list of Boards // then we call our function passing required values callback(response, "Success");}
This function takes two parameters as input, one being the name of the client for whom we will fetch all the boards and the other being the callback function. As we can see in the function ...
Read now
Unlock full access