jeudi 3 novembre 2016

typescript - create a callback function

hey guys i'd like to know how to make a callback function in typescript.

I know how to do it in vanilla JS :

function mySandwich(param1, param2, callback) {
alert('Started eating my sandwich.\n\nIt has: ' + param1 + ', ' + param2);
callback();}

mySandwich('ham', 'cheese', function() {
alert('Finished eating my sandwich.');});

But i can't find a way to do it with TS. you guys have an example of it?

thank you!




Aucun commentaire:

Enregistrer un commentaire