redux-script-loader
Contents
Usage
A simple example:
; ;
Installation
To install from npm:
$ npm install --save redux-script-loader
Then to configure with your redux store:
;;; const store = ;
API
RSL_LOAD
:: Symbol
A symbol indicating that the action should be handled by the redux-script-loader
middleware.
loaderMiddleware
:: Function
Returns a redux-compatible middleware. Must be initialised with the document
object.
RSL Actions
action.type
:: Symbol
Must be RSL_LOAD
imported from the redux-script-loader
package.
action.payload
:: String
The URL from which to load the script. Will be used as the src
attribute of the script
tag.
action.append
:: String | FSA
Action to dispatch when appending the script tag to the document. Can either be a string, or a Flux standard action.
action.success
:: String | FSA
Action to dispatch when the appended script tag finishes loading. Equivalent to the load
event on the script
element.
action.fail
:: String | FSA
Action to dispatch when the appended script tag fails to load. Equivalent to the error
event on the script
element.