첫 함수 호출하기

이제 SDK 버전을 확인하는 간단한 함수를 호출해 보겠습니다. 이를 통해 SDK가 제대로 설치되어 작동하는지 확인할 수 있습니다. 호출에 대한 응답은 웹브라우저 개발자 도구의 Console 탭에서 확인할 수 있습니다.

  • npm으로 SDK를 설치한 경우

  • 브라우저에 SDK를 포함시킨 경우

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를 말합니다.
도움이 필요한가요?

문서에 대해 궁금한 점이나 피드백이 있나요? 텐투플레이 디스코드에서 바로 문의주세요.