I want to declare custom widget api in script

Hi Team,

I want to use custom widget api in javascript and I am getting exception like below screenshoe. 

Can anyone help me to how to declare custom widget api in javascript PFA below?? Thanks!



Regrads,

Kiran Cherukuri.