Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edmundhung/react-async-loader
Async script loading composition
https://github.com/edmundhung/react-async-loader
Last synced: 2 months ago
JSON representation
Async script loading composition
- Host: GitHub
- URL: https://github.com/edmundhung/react-async-loader
- Owner: edmundhung
- License: mit
- Created: 2015-07-26T06:27:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-28T14:49:23.000Z (almost 8 years ago)
- Last Synced: 2024-10-08T05:04:52.329Z (3 months ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
react-async-loader
==================
Async scripts loading compositionFeatures include:
* jsonp support
* multiple scripts loadingInstallation
------------```
$ npm install react-async-loader
```Usage
-----```
// using an ES6 transpiler
import asyncLoad from 'react-async-loader';// not using an ES6 transpiler
var asyncLoad = require('react-async-loader');
```The only API `asyncLoad(mapScriptsToProps) => AsyncLoaded(Component)` receives 1 parameter and returns a function to connect with your Component.
* mapScriptsToProps (props => Config Object) - Configure scripts that are required to be injected into the component when loaded
* Component (React Component) - The component being wrappedConfig Object
- #key: The object key is the name that will be used when injecting the loaded script.
- globalPath: The script name to be injected from the global scope (window). E.g. google.maps
- url: The url of the script, exclude callback parameter for jsonp.
- jsonp: Optional. Append callback parameter to scriptUrl when true.
- callbackName: Optional. Added for Facebook SDK.Example
-------
See this [GoogleMap example](https://github.com/EdStudio/react-async-loader/tree/master/example/)Changelog
-------
[2015-11-30] Version 0.1.01. API Redesigned: Improve configurability based on Components properties (mapScriptsToProps)
2. Enable auto static function exposures with hoist-non-react-statics
3. Fix a bug with server side rendering (No window and document object)License
-------
MIT