@timesinternet/times-ondemandloader
v1.0.3
Published
Loads external files on demand
Downloads
2
Keywords
Readme
A React component to load external js files
Installation
Browser
npm install --save @timesinternet/times-ondemandloader
Browser
import OnDemandLoader from 'times-ondemandloader';
export class MyComponent extends Component {
componentWillMount() {
this.scriptCache = OnDemandLoader({
slikeSDK: 'https://videoplayer.indiatimes.com/v2/sdk.js'
});
}
componentDidMount() {
this.scriptCache.slikeSDK.onLoad(() => {
console.log('slike sdk loaded');
})
}
render(){
return(
<div>
</div>
)
}
}
export default MyComponent;