You just need to check whether the JS library defines/initialize any known variable on the window or not.
If it does then you just need to wait for the variable to appear. Try using the code given below:
To test the condition like :
window.SomeClass && window.SomeClass.variable != null
and return a boolean true/false. Try wrapping this in a WebDriverWait, and wait until the script returns true.