{"_id":"react-async-script-loader","_rev":"12-b452400d5915bce84cf6d390be8d36bd","name":"react-async-script-loader","description":"A decorator for script lazy loading on react component","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"react-async-script-loader","version":"0.1.0","description":"A decorator for script lazy loading on react component","main":"lib/index.js","scripts":{"build":"babel src --out-dir lib","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/leozdgao/react-script-loader.git"},"keywords":["react","reactjs","react-component"],"author":{"name":"leozdgao"},"license":"MIT","bugs":{"url":"https://github.com/leozdgao/react-script-loader/issues"},"homepage":"https://github.com/leozdgao/react-script-loader#readme","peerDependencies":{"react":"^0.14.0"},"devDependencies":{"babel-cli":"^6.1.18","babel-eslint":"^4.1.5","babel-plugin-syntax-class-properties":"^6.1.18","babel-plugin-transform-class-properties":"^6.1.20","babel-preset-es2015":"^6.1.18","babel-preset-react":"^6.1.18","babel-preset-stage-0":"^6.1.18","eslint":"^1.9.0"},"dependencies":{"hoist-non-react-statics":"^1.0.3"},"gitHead":"2862e77eb596f7de6a999a776a08658b6f2fa046","_id":"react-async-script-loader@0.1.0","_shasum":"abc1e4eae99fecaef60ae724d17bd7cf80379e0d","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"leozdgao","email":"gzdleo0816@hotmail.com"},"dist":{"shasum":"abc1e4eae99fecaef60ae724d17bd7cf80379e0d","tarball":"https://registry.npmjs.org/react-async-script-loader/-/react-async-script-loader-0.1.0.tgz","integrity":"sha512-msgmn7u+8OQMTGqQaLF51Jd+5ymODhnsbg034r22TBE4SG2pkW1GH8tTHcMRCITqxKZlVfEIDVwCiKk790pzXQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDCGA2rYFRrbGqdEXqHJ/2ip3DooLzXGqyuNX8T5p/9XQIhAKbx5LfoS7ODBeLtiBeYcN1EmLyNTacz9BR8KIV29Svp"}]},"maintainers":[{"name":"leozdgao","email":"gzdleo0816@hotmail.com"}]},"0.1.1":{"name":"react-async-script-loader","version":"0.1.1","description":"A decorator for script lazy loading on react component","main":"lib/index.js","scripts":{"build":"babel src --out-dir lib","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/leozdgao/react-script-loader.git"},"keywords":["react","reactjs","react-component"],"author":{"name":"leozdgao"},"license":"MIT","bugs":{"url":"https://github.com/leozdgao/react-script-loader/issues"},"homepage":"https://github.com/leozdgao/react-script-loader#readme","peerDependencies":{"react":"^0.14.0"},"devDependencies":{"babel-cli":"^6.1.18","babel-eslint":"^4.1.5","babel-plugin-syntax-class-properties":"^6.1.18","babel-plugin-transform-class-properties":"^6.1.20","babel-preset-es2015":"^6.1.18","babel-preset-react":"^6.1.18","babel-preset-stage-0":"^6.1.18","eslint":"^1.9.0"},"dependencies":{"hoist-non-react-statics":"^1.0.3"},"gitHead":"2862e77eb596f7de6a999a776a08658b6f2fa046","_id":"react-async-script-loader@0.1.1","_shasum":"01e2b5bc241c278dd00f92158e5d9c9b1de6fc4a","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"leozdgao","email":"gzdleo0816@hotmail.com"},"dist":{"shasum":"01e2b5bc241c278dd00f92158e5d9c9b1de6fc4a","tarball":"https://registry.npmjs.org/react-async-script-loader/-/react-async-script-loader-0.1.1.tgz","integrity":"sha512-GegJOeibynuq1X/+HE7QI+7h0UvelH5Vi7LiuRaROpGKhv/sm1rvWcGet9deMYPm7iVKvu00FuF/7t1TeuOTAg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIJYc+9mozp9YvhbmlUXJEvHJAXJV73arWxtB8LogOzAIgDsKARYEydxBAU4QbN6dDeqwf9sfkbnM6kw/Fg606uJc="}]},"maintainers":[{"name":"leozdgao","email":"gzdleo0816@hotmail.com"}]},"0.2.0":{"name":"react-async-script-loader","version":"0.2.0","description":"A decorator for script lazy loading on react component","main":"lib/index.js","scripts":{"build":"babel src --out-dir lib","prepublish":"npm run build","test":"karma start"},"repository":{"type":"git","url":"git+https://github.com/leozdgao/react-script-loader.git"},"keywords":["react","reactjs","react-component"],"author":{"name":"leozdgao"},"license":"MIT","bugs":{"url":"https://github.com/leozdgao/react-script-loader/issues"},"homepage":"https://github.com/leozdgao/react-script-loader#readme","peerDependencies":{"react":"^0.14.0"},"devDependencies":{"babel-cli":"^6.1.18","babel-eslint":"^4.1.5","babel-loader":"~6.2.4","babel-plugin-syntax-class-properties":"^6.1.18","babel-plugin-transform-class-properties":"^6.1.20","babel-preset-es2015":"^6.1.18","babel-preset-react":"^6.1.18","babel-preset-stage-0":"^6.1.18","chai":"~3.5.0","eslint":"^1.9.0","karma":"~0.13.22","karma-chai":"~0.1.0","karma-mocha":"~0.2.2","karma-mocha-reporter":"~2.0.0","karma-phantomjs-launcher":"~1.0.0","karma-sourcemap-loader":"~0.3.7","karma-webpack":"~1.7.0","mocha":"~2.4.5","phantomjs-prebuilt":"~2.1.7","react":"^0.14.7","react-addons-test-utils":"^0.14.7","react-dom":"^0.14.7","webpack":"~1.12.14"},"dependencies":{"hoist-non-react-statics":"^1.0.3"},"gitHead":"419348f3c4d97b26c09d370007b6e8ff078f87ca","_id":"react-async-script-loader@0.2.0","_shasum":"1c6a72ed49eb297d3b212684e4fd2ffcabf8c30a","_from":".","_npmVersion":"3.5.1","_nodeVersion":"5.2.0","_npmUser":{"name":"leozdgao","email":"gzdleo0816@hotmail.com"},"dist":{"shasum":"1c6a72ed49eb297d3b212684e4fd2ffcabf8c30a","tarball":"https://registry.npmjs.org/react-async-script-loader/-/react-async-script-loader-0.2.0.tgz","integrity":"sha512-XHktrJBQPfS0obcNMyc0iZMYWHy2RLvuMUXc/O89Z7yXuvRRxnITs2qPmEbY4U6CqbgrPSCU1xwWertfiljMHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHEKbDPao2oLjQH1r8VoXiUxcIAOaefKCMt2YTwtTIEiAiEA47howo9Dwz2BbgxCtH68msDkSMKgx784uuiqmAEtNcU="}]},"maintainers":[{"name":"leozdgao","email":"gzdleo0816@hotmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/react-async-script-loader-0.2.0.tgz_1459577483242_0.4931578857358545"}},"0.2.1":{"name":"react-async-script-loader","version":"0.2.1","description":"A decorator for script lazy loading on react component","main":"lib/index.js","scripts":{"build":"babel src --out-dir lib","prepublish":"npm run build","test":"karma start"},"repository":{"type":"git","url":"git+https://github.com/leozdgao/react-script-loader.git"},"keywords":["react","reactjs","react-component"],"author":{"name":"leozdgao"},"license":"MIT","bugs":{"url":"https://github.com/leozdgao/react-script-loader/issues"},"homepage":"https://github.com/leozdgao/react-script-loader#readme","peerDependencies":{"react":"^15.0.1"},"devDependencies":{"babel-cli":"^6.1.18","babel-eslint":"^4.1.5","babel-loader":"~6.2.4","babel-plugin-syntax-class-properties":"^6.1.18","babel-plugin-transform-class-properties":"^6.1.20","babel-preset-es2015":"^6.1.18","babel-preset-react":"^6.1.18","babel-preset-stage-0":"^6.1.18","chai":"~3.5.0","eslint":"^1.9.0","karma":"~0.13.22","karma-chai":"~0.1.0","karma-mocha":"~0.2.2","karma-mocha-reporter":"~2.0.0","karma-phantomjs-launcher":"~1.0.0","karma-sourcemap-loader":"~0.3.7","karma-webpack":"~1.7.0","mocha":"~2.4.5","phantomjs-prebuilt":"~2.1.7","react":"^15.0.1","react-addons-test-utils":"^15.0.1","react-dom":"^15.0.1","webpack":"~1.12.14"},"dependencies":{"hoist-non-react-statics":"^1.0.3"},"gitHead":"ab5ef3089fabe29bca439176997fff2b45460a48","_id":"react-async-script-loader@0.2.1","_shasum":"1f9fc056bb2b2ae427d4375041c723f61ed7b296","_from":".","_npmVersion":"3.5.1","_nodeVersion":"5.2.0","_npmUser":{"name":"leozdgao","email":"gzdleo0816@hotmail.com"},"dist":{"shasum":"1f9fc056bb2b2ae427d4375041c723f61ed7b296","tarball":"https://registry.npmjs.org/react-async-script-loader/-/react-async-script-loader-0.2.1.tgz","integrity":"sha512-fn1yggMnvSuyLICPYtTQml5ch3+03sxBlQUsx4v3lh0MJoriPADuLuTdPyDyxN/1qo1dFYaHs6rene7+Ugq/Rw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBdslX8a6HyiV3yAUeD4/DC/xuuCDs1c8i/8BagaSoBlAiEAiLsqcNzYNa5whopcp8KeTkLx3FDw5h8VG++DO+GjB6U="}]},"maintainers":[{"name":"leozdgao","email":"gzdleo0816@hotmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/react-async-script-loader-0.2.1.tgz_1460266017025_0.8921415999066085"}},"0.2.2":{"name":"react-async-script-loader","version":"0.2.2","description":"A decorator for script lazy loading on react component","main":"lib/index.js","scripts":{"build":"babel src --out-dir lib","prepublish":"npm run build","test":"karma start"},"repository":{"type":"git","url":"git+https://github.com/leozdgao/react-script-loader.git"},"keywords":["react","reactjs","react-component"],"author":{"name":"leozdgao"},"license":"MIT","bugs":{"url":"https://github.com/leozdgao/react-script-loader/issues"},"homepage":"https://github.com/leozdgao/react-script-loader#readme","peerDependencies":{"react":"^15.0.1"},"devDependencies":{"babel-cli":"^6.1.18","babel-eslint":"^4.1.5","babel-loader":"~6.2.4","babel-plugin-syntax-class-properties":"^6.1.18","babel-plugin-transform-class-properties":"^6.1.20","babel-preset-es2015":"^6.1.18","babel-preset-react":"^6.1.18","babel-preset-stage-0":"^6.1.18","chai":"~3.5.0","eslint":"^1.9.0","karma":"~0.13.22","karma-chai":"~0.1.0","karma-mocha":"~0.2.2","karma-mocha-reporter":"~2.0.0","karma-phantomjs-launcher":"~1.0.0","karma-sourcemap-loader":"~0.3.7","karma-webpack":"~1.7.0","mocha":"~2.4.5","phantomjs-prebuilt":"~2.1.7","react":"^15.0.1","react-addons-test-utils":"^15.0.1","react-dom":"^15.0.1","webpack":"~1.12.14"},"dependencies":{"hoist-non-react-statics":"^1.0.3"},"gitHead":"63dd0a953d43c07ff8dfb57aebc63702c95d01c7","_id":"react-async-script-loader@0.2.2","_shasum":"70ae44c143539a2f2d4f79aa5f177f244eea8c55","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.1","_npmUser":{"name":"leozdgao","email":"gzdleo0816@hotmail.com"},"dist":{"shasum":"70ae44c143539a2f2d4f79aa5f177f244eea8c55","tarball":"https://registry.npmjs.org/react-async-script-loader/-/react-async-script-loader-0.2.2.tgz","integrity":"sha512-gQwZmR6Bs1OPUtv4hsAC9wPB+swiaGobCT8MLrvGilpRoPE0HrcjgMfUmwtvbHfvKWbq8C/HMAzx1zu3IQKRNw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIErMKjjdz27K4EbWaIE66LsQP5hUbBJswv8u25euW40uAiB9KgK+09A1S+XVcAU04Vsdqb5DvCf8BsRY7V/nND4qyQ=="}]},"maintainers":[{"name":"leozdgao","email":"gzdleo0816@hotmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/react-async-script-loader-0.2.2.tgz_1479867320561_0.36819898476824164"}},"0.3.0":{"name":"react-async-script-loader","version":"0.3.0","description":"A decorator for script lazy loading on react component","main":"lib/index.js","scripts":{"build":"babel src --out-dir lib","prepublish":"npm run build","test":"karma start"},"repository":{"type":"git","url":"git+https://github.com/leozdgao/react-script-loader.git"},"keywords":["react","reactjs","react-component"],"author":{"name":"leozdgao"},"license":"MIT","bugs":{"url":"https://github.com/leozdgao/react-script-loader/issues"},"homepage":"https://github.com/leozdgao/react-script-loader#readme","peerDependencies":{"react":"^15.5.4"},"devDependencies":{"babel-cli":"^6.1.18","babel-eslint":"^4.1.5","babel-loader":"~6.2.4","babel-plugin-syntax-class-properties":"^6.1.18","babel-plugin-transform-class-properties":"^6.1.20","babel-preset-es2015":"^6.1.18","babel-preset-react":"^6.1.18","babel-preset-stage-0":"^6.1.18","chai":"~3.5.0","eslint":"^1.9.0","karma":"~0.13.22","karma-chai":"~0.1.0","karma-mocha":"~0.2.2","karma-mocha-reporter":"~2.0.0","karma-phantomjs-launcher":"~1.0.0","karma-sourcemap-loader":"~0.3.7","karma-webpack":"~1.7.0","mocha":"~2.4.5","phantomjs-prebuilt":"~2.1.7","prop-types":"~15.5.8","react":"^15.0.1","react-addons-test-utils":"^15.0.1","react-dom":"^15.0.1","webpack":"~1.12.14"},"dependencies":{"hoist-non-react-statics":"^1.0.3"},"gitHead":"306d55864fa58037f730432c6879ebba86cda610","_id":"react-async-script-loader@0.3.0","_shasum":"c742b3ca25e08ba61ab7eb64371f814027692b86","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.1","_npmUser":{"name":"leozdgao","email":"gzdleo0816@hotmail.com"},"dist":{"shasum":"c742b3ca25e08ba61ab7eb64371f814027692b86","tarball":"https://registry.npmjs.org/react-async-script-loader/-/react-async-script-loader-0.3.0.tgz","integrity":"sha512-g2pokd4l9IG95RlKmrthyxMl5tSrlEQgRC18skLpyuDDkljsuR8UHAnf27Oy/Fkl0PfXCkWWG/VDjsiifDCJtA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICswHI7+8NkHgRdegNJ/ZS0ZOkRSX6p7VNXSUP4FWf0sAiEA7OJwqbAAE9UwkFItrVkaOeH5yXk/X77impUt7oSSrTY="}]},"maintainers":[{"name":"leozdgao","email":"gzdleo0816@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-async-script-loader-0.3.0.tgz_1496047339072_0.689984068274498"}}},"readme":"# react-async-script-loader\n\n[![Build Status](https://travis-ci.org/leozdgao/react-async-script-loader.svg?branch=master)](https://travis-ci.org/leozdgao/react-async-script-loader) [![npm version](https://badge.fury.io/js/react-async-script-loader.svg)](https://badge.fury.io/js/react-async-script-loader)\n\nA decorator for script lazy loading on react component.\n\n## Description\n\nSome component may depend on other vendors which you may not want to load them until you really need them. So here it is, use **High Order Component** to decorate your component and it will handle lazy loading for you, it support parallel and sequential loading.\n\n## Installation\n\n```bash\nnpm install --save react-async-script-loader\n```\n\n## API\n\n```javascript\nscriptLoader(...scriptSrc)([WrappedComponent])\n```\n\n`scriptSrc` can be a string of source or an array of source. `scriptSrc` will be loaded sequentially, but array of source will be loaded parallelly. It also cache the loaded script to avoid duplicated loading. More lively description see use case below.\n\n## Properties\n\nDecorated component will receive following properties:\n\n|Name|Type|Description|\n|----|----|-----------|\n|isScriptLoaded|Boolean|Represent scripts loading process is over or not, maybe part of scripts load failed.|\n|isScriptLoadSucceed|Boolean|Represent all scripts load successfully or not.|\n|onScriptLoaded|Function|Triggered when all scripts load successfully.|\n\n## How to use\n\nYou can use it to decorate your component.\n\n```javascript\nimport React, { Component } from 'react'\nimport scriptLoader from 'react-async-script-loader'\n\nclass Editor extends Component {\n  ...\n\n  componentWillReceiveProps ({ isScriptLoaded, isScriptLoadSucceed }) {\n    if (isScriptLoaded && !this.props.isScriptLoaded) { // load finished\n      if (isScriptLoadSucceed) {\n        this.initEditor()\n      }\n      else this.props.onError()\n    }\n  }\n\n  componentDidMount () {\n    const { isScriptLoaded, isScriptLoadSucceed } = this.props\n    if (isScriptLoaded && isScriptLoadSucceed) {\n      this.initEditor()\n    }\n  }\n\n  ...\n}\n\nexport default scriptLoader(\n  [\n    'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js',\n    'https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js'\n  ],\n  '/assets/bootstrap-markdown.js'\n)(Editor)\n```\n\nThe example above means that the `jquery` and `marked` will be loading parallelly, and after loaded these 2 vendors, load `bootstrap-markdown` sequentially.\n\nIt is possible that some script will be failed to load. ScriptLoader will cache the script that load successfully and will remove the script node which fail to load before.\n\n*Currently, if you try to reload scripts, you have to remount your component.*\n\nAnd it's cooler if you use decorator syntax. (ES7)\n\n```javascript\n@scriptLoader(\n  [\n    'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js',\n    'https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js'\n  ],\n  '/assets/bootstrap-markdown.js'\n)\nclass Editor extends Component {\n\n}\n```\n\n## license\n\nMIT\n","maintainers":[{"name":"leozdgao","email":"gzdleo0816@hotmail.com"}],"time":{"modified":"2022-06-25T16:27:21.659Z","created":"2015-11-17T12:21:18.758Z","0.1.0":"2015-11-17T12:21:18.758Z","0.1.1":"2015-11-17T12:26:06.345Z","0.2.0":"2016-04-02T06:11:23.755Z","0.2.1":"2016-04-10T05:26:59.265Z","0.2.2":"2016-11-23T02:15:22.541Z","0.3.0":"2017-05-29T08:42:19.165Z"},"homepage":"https://github.com/leozdgao/react-script-loader#readme","keywords":["react","reactjs","react-component"],"repository":{"type":"git","url":"git+https://github.com/leozdgao/react-script-loader.git"},"author":{"name":"leozdgao"},"bugs":{"url":"https://github.com/leozdgao/react-script-loader/issues"},"license":"MIT","readmeFilename":"README.md","users":{"pedroparra":true,"actionwolf":true,"wearevilla":true,"eijs":true}}