Skip to content

1.6.0

Compare
Choose a tag to compare
@jeongbaebang jeongbaebang released this 30 Mar 09:24
· 35 commits to main since this release
  • onBefore 핸들러 추가
  • 타입 개선
  • 리드미 개선
// Promises chaining
startLoadingIndicator();
getAvatarUrlfromGithub(USER_NAME)
  .then(showAvatar)
  .then((githubUser) => console.log(`avatar_url: ${githubUser.avatar_url}`))
  .catch((error) => console.error(error))
  .finally(endLoadingIndicator);

// with asyncWave
asyncWave<GithubUser>([USER_NAME, getAvatarUrlfromGithub], {
  onBefore: () => {
    startLoadingIndicator(); 
  },
  onSuccess: async (githubUser) => {
    await showAvatar(githubUser); // 핸들러 내부 에러도 캐치됩니다!
    console.log(`avatar_url: ${githubUser.avatar_url}`);
  },
  onError: (error) => {
    console.error(error);
  },
  onSettled: () => {
    endLoadingIndicator();
  },
});