Skip to content

Instantly share code, notes, and snippets.

@rajatgeekyants
Created June 18, 2018 12:36
Show Gist options
  • Save rajatgeekyants/b7634785a278c3554afc636140b94ca4 to your computer and use it in GitHub Desktop.
Save rajatgeekyants/b7634785a278c3554afc636140b94ca4 to your computer and use it in GitHub Desktop.
const hero = {
superman: {
name: 'Superman',
alias: 'Clark Kent',
},
batman: {
name: 'Batman',
alias: 'Bruce Wayne',
},
flash: {
name: 'The Flash',
alias: 'Barry Allen',
},
};
export async function getHero(handle: string) {
return new Promise<{name: string; alias: string}>(res => {
setTimeout(() => {
res(hero[handle]);
}, 1000);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment