move jssdk to a function