썬더는 특정 액션시 디폴트로 브라우저 alert()
함수를 이용해 에러, 성공 등의 메세지를 디스플레이(Thunder.notify()
)합니다.
썬더에서는 기본 브라우저 alert()
의 대안으로, 더 나은 알림 메세지 UI를 제공하기 위해서 NOTY JavaScript 라이브러리를 이용한 알림 플러그인을 제공합니다.
NOTY - a dependency-free notification library
설치 및 설정이 완료되면 썬더에서 기존에 alert()
알림이 디스플레이 되던 부분들이 NOTY를 이용해서 대체된 부분을 확인할 수 있습니다.
우선 플러그인 설치를 위해서 썬더의 설치문 밑에 다음과 같은 스타일/스크립트 설치문을 추가해주세요.
<!-- 디펜던시: NOTY 스타일(CSS) -->
<link rel="stylesheet" type="text/css" href="<https://unpkg.com/[email protected]/lib/noty.css>">
<link rel="stylesheet" type="text/css" href="<https://unpkg.com/[email protected]/lib/themes/metroui.css>">
<!-- 디펜던시: NOTY 스크립트 -->
<script src="<https://unpkg.com/[email protected]/lib/noty.js>"></script>
<!-- ... 썬더 설치 코드 -->
<!-- 썬더: NOTY 알림 플러그인 -->
<script src="<https://code.clayful.io/[email protected]/plugins/notification/noty.min.js>"></script>
설치가 완료되었으면, 다음과 같이 플러그인을 설정할 수 있습니다.
Thunder({
...
plugins: {
notification: ThunderNotificationNoty()
}
});