ujet.on(eventName, callback)
ujet.off(eventName, callback)
생성됨
Web SDK 위젯이 생성되는 경우. 일반적으로 런처를 클릭할 때 발생합니다.
이 이벤트를 사용하여 인증 토큰을 전송할 수 있습니다.
const ujet = new UJET({
// ...
// authenticate: getAuthToken
})
// when you didn't use `authenticate` option, you need to call
// `.authenticate` method manually
ujet.on('created, () => {
fetch('/token').then(resp => {
return resp.json()
}).then(data => {
ujet.authenticate({ token: data.token })
})
})
승인됨
이 이벤트는 .authenticate 메서드가 호출되고 Web SDK에 token으로 응답될 때 발생합니다.
준비됨
Web SDK가 company 정보를 가져왔으며 이제 사용할 준비 가 되었습니다.
unread
unread 채팅 메시지 수 내보내기:
ujet.on('unread', function(num) {
console.log('has ' + num + ' unread messages')
})
닫기
Web SDK가 닫힌 경우. 이 이벤트는 SDK에서 '닫기' 버튼을 클릭하거나 런처를 클릭하여 SDK를 닫을 때 발생합니다.