Toast

[data-toast]

<button type="button" onclick="new SKY.Toast().show(messageBtn, 1, 'type1')">토스트 호출</button>
<div class="toast">
    <div class="toast-content">
        스크립트 <span style="color: red;">생성</span>
    </div>
</div>

Events

시점에 따른 이벤트

document.addEventListener('toast.shown', function() {
    console.log(this, 'shown');
})
document.addEventListener('toast.hidden', function() {
    console.log(this, 'hidden');
})

Method

Component 호출

// Toast 함수는 인스턴스화 하면 안됨.
// 첫번쨰 인자: string: html,
// 두번째 인자: number: 떠있는 시간 (default: 2초),
// 세번째 인자: string: class명 (.toast-content에 붙음)
const message = '스크립트 <span style="color: red;">생성</span>';
const messageBtn = '버튼 클릭 <span style="color: red;">생성</span>';
new SKY.Toast().show(message);