첫 함수 호출하기
이제 SDK 버전을 확인하는 간단한 함수를 호출해 보겠습니다. 이를 통해 SDK가 제대로 설치되어 작동하는지 확인할 수 있습니다. 호출에 대한 응답은 웹브라우저 개발자 도구의 Console 탭에서 확인할 수 있습니다.
import { TentuPlay } from '@tentuplay/js-client-sdk';
const tp = new TentuPlay({
clientKey: "{clientKey}", (1)
});
tp.onInit(() => {
console.log(tp.SDKVersion);
})
1 | 텐투플레이 콘솔에서 발급받은 Client key를 말합니다. |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>TentuPlay JavaScript SDK</title>
<script src="YOUR_SDK_FILE_PATH"></script>
<script>
const tp = new TentuPlay({
clientKey: "{clientKey}", (1)
});
tp.onInit(() => {
console.log(tp.SDKVersion);
})
</script>
</head>
<body></body>
</html>
1 | 텐투플레이 콘솔에서 발급받은 Client key를 말합니다. |