@timesinternet/times-ondemandloader

Loads external files on demand

Stats

StarsIssuesVersionUpdatedCreatedSize
@timesinternet/times-ondemandloader
1.0.33 years ago3 years agoMinified + gzip package size for @timesinternet/times-ondemandloader in KB

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;

License

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.