외부 라이브러리 타입 정의 - ChoDragon9/posts GitHub Wiki
tiara-tracker.d.ts
declare const TiaraTracker: TiaraTracker
/* TiaraTracker module definition */
interface Window {
TiaraTracker: TiaraTracker
}
interface TiaraTracker {
getInstance(): TiaraTracker
setSvcDomain(param: string): TiaraTracker
setPage(param: string): TiaraTracker
setSection(param: string): TiaraTracker
trackPage(param: string): TiaraTracker
track(): TiaraTracker
}
사용측
if (!window.TiaraTracker) {
return
}
window.TiaraTracker.getInstance()
.setSvcDomain(SERVICE_HOST)
.setSection(TIARA_SECTION[pageName])
.setPage(pageName)
.trackPage(TIARA_PAGE_TITLE[pageName])
.track()