Dear Alex,
You can implement this by two ways:
fd.spRendered(function(){
var imported = document.createElement('script');
imported.src = 'URL of JS file';
document.head.appendChild(imported);
})
or with the help of $.getScript(): Difference between two dates in years, months, days in JavaScript