{"_id":"@soda/get-current-script","_rev":"196019","name":"@soda/get-current-script","description":"get the current executing script, with polyfills for IE9+ and Firefox","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"soda","email":"imyanglan@163.com"}],"time":{"modified":"2021-06-03T12:29:36.000Z","created":"2020-03-09T07:49:00.198Z","1.0.2":"2020-06-16T02:04:15.387Z","1.0.1":"2020-06-04T14:46:29.354Z","1.0.0":"2020-03-09T07:49:00.198Z"},"users":{},"author":{"name":"Haoqun Jiang"},"repository":{"type":"git","url":"git+https://github.com/sodatea/get-current-script.git"},"versions":{"1.0.2":{"name":"@soda/get-current-script","version":"1.0.2","description":"get the current executing script, with polyfills for IE9+ and Firefox","main":"index.js","scripts":{"start":"serve .","test:chrome":"nightwatch -t test.js -e chrome","test:firefox":"nightwatch -t test.js -e firefox","test:ie":"nightwatch -t test.js -e ie","ci:chrome":"yarn start-test start http://localhost:5000 test:chrome","ci:firefox":"yarn start-test start http://localhost:5000 test:firefox","ci:ie":"yarn start-test start http://localhost:5000 test:ie","ci":"yarn ci:chrome && yarn ci:firefox && yarn ci:ie"},"repository":{"type":"git","url":"git+https://github.com/sodatea/get-current-script.git"},"author":{"name":"Haoqun Jiang"},"license":"MIT","dependencies":{},"devDependencies":{"chromedriver":"^83.0.0","geckodriver":"^1.19.1","iedriver":"^3.14.1","nightwatch":"^1.3.4","selenium-server":"^3.141.59","serve":"^11.3.1","start-server-and-test":"^1.10.8"},"publishConfig":{"access":"public"},"gitHead":"79e86ee8ef8db24209f95750a88634e311d0a08b","bugs":{"url":"https://github.com/sodatea/get-current-script/issues"},"homepage":"https://github.com/sodatea/get-current-script#readme","_id":"@soda/get-current-script@1.0.2","_nodeVersion":"12.17.0","_npmVersion":"6.14.5","dist":{"shasum":"a53515db25d8038374381b73af20bb4f2e508d87","size":5342,"noattachment":false,"key":"/@soda/get-current-script/-/@soda/get-current-script-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@soda/get-current-script/download/@soda/get-current-script-1.0.2.tgz"},"maintainers":[{"name":"soda","email":"imyanglan@163.com"}],"_npmUser":{"name":"soda","email":"haoqunjiang+npm@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-current-script_1.0.2_1592273055284_0.6660725152795723"},"_hasShrinkwrap":false,"publish_time":1592273055387,"_cnpm_publish_time":1592273055387},"1.0.1":{"name":"@soda/get-current-script","version":"1.0.1","description":"get the current executing script, with polyfills for IE9+ and Firefox","main":"index.js","scripts":{"start":"serve .","test:chrome":"nightwatch -t test.js -e chrome","test:firefox":"nightwatch -t test.js -e firefox","test:ie":"nightwatch -t test.js -e ie","ci:chrome":"yarn start-test start http://localhost:5000 test:chrome","ci:firefox":"yarn start-test start http://localhost:5000 test:firefox","ci:ie":"yarn start-test start http://localhost:5000 test:ie","ci":"yarn ci:chrome && yarn ci:firefox && yarn ci:ie"},"repository":{"type":"git","url":"git+https://github.com/sodatea/get-current-script.git"},"author":{"name":"Haoqun Jiang"},"license":"MIT","dependencies":{},"devDependencies":{"chromedriver":"^83.0.0","geckodriver":"^1.19.1","iedriver":"^3.14.1","nightwatch":"^1.3.4","selenium-server":"^3.141.59","serve":"^11.3.1","start-server-and-test":"^1.10.8"},"publishConfig":{"access":"public"},"gitHead":"dce9792417963716521520faa00ce7ad0c33d550","bugs":{"url":"https://github.com/sodatea/get-current-script/issues"},"homepage":"https://github.com/sodatea/get-current-script#readme","_id":"@soda/get-current-script@1.0.1","_nodeVersion":"12.17.0","_npmVersion":"6.14.4","dist":{"shasum":"f4afffcb36e069a801d5339c90499601c47a2516","size":5345,"noattachment":false,"key":"/@soda/get-current-script/-/@soda/get-current-script-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@soda/get-current-script/download/@soda/get-current-script-1.0.1.tgz"},"maintainers":[{"name":"soda","email":"imyanglan@163.com"}],"_npmUser":{"name":"soda","email":"haoqunjiang+npm@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-current-script_1.0.1_1591281989153_0.2518003194341065"},"_hasShrinkwrap":false,"publish_time":1591281989354,"_cnpm_publish_time":1591281989354},"1.0.0":{"name":"@soda/get-current-script","version":"1.0.0","description":"get the current executing script, with polyfills for IE9+ and Firefox","main":"index.js","scripts":{"start":"serve .","test:chrome":"nightwatch -t test.js -e chrome","test:firefox":"nightwatch -t test.js -e firefox","test:ie":"nightwatch -t test.js -e ie","ci:chrome":"yarn start-test start http://localhost:5000 test:chrome","ci:firefox":"yarn start-test start http://localhost:5000 test:firefox","ci:ie":"yarn start-test start http://localhost:5000 test:ie","ci":"yarn ci:chrome && yarn ci:firefox && yarn ci:ie"},"repository":{"type":"git","url":"git+https://github.com/sodatea/get-current-script.git"},"author":{"name":"Haoqun Jiang"},"license":"MIT","dependencies":{},"devDependencies":{"chromedriver":"^80.0.1","geckodriver":"^1.19.1","iedriver":"^3.14.1","nightwatch":"^1.3.4","selenium-server":"^3.141.59","serve":"^11.3.0","start-server-and-test":"^1.10.8"},"publishConfig":{"access":"public"},"gitHead":"c308b2fe04b823e8e1acb0ac5e7b7af4add68b39","bugs":{"url":"https://github.com/sodatea/get-current-script/issues"},"homepage":"https://github.com/sodatea/get-current-script#readme","_id":"@soda/get-current-script@1.0.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.0","dist":{"shasum":"623aa40623550e3b94767cffeb096a6fb597ed09","size":5109,"noattachment":false,"key":"/@soda/get-current-script/-/@soda/get-current-script-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@soda/get-current-script/download/@soda/get-current-script-1.0.0.tgz"},"maintainers":[{"name":"soda","email":"imyanglan@163.com"}],"_npmUser":{"name":"soda","email":"haoqunjiang+npm@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-current-script_1.0.0_1583740139984_0.3337941287485322"},"_hasShrinkwrap":false,"publish_time":1583740140198,"_cnpm_publish_time":1583740140198}},"readme":"# @soda/get-current-script ![CI](https://github.com/sodatea/get-current-script/workflows/CI/badge.svg)\n\nIt is basically a function that returns `document.currentScript` but with support for IE9-11, thanks to https://github.com/amiller-gh/currentScript-polyfill.\n\nIt also works around a [Firefox issue](https://bugzilla.mozilla.org/show_bug.cgi?id=1620505) when the script is called in a microtask, which makes `document.currentScript` unusable in a webpack dynamic-imported chunk.\n\nIt is shipped as a utility function rather than a polyfill, because we can't easily tell if the `document.currentScript` is returning `null` due to the Firefox issue or because it's running in an event handler / a callback.\n\nThe implementation here may not adhere strictly to `document.currentScript` spec when called in async code or in a callback. In these situations the spec calls for `document.currentScript` to return `null`. However, for the grand majority of your `document.currentScript` needs, this utility will do the job!\n\n## Usage\n\n```sh\nnpm i @soda/get-current-script\n```\n\n```js\nconst getCurrentScript = require('@soda/get-current-script')\nconst script = getCurrentScript() // the current executing <script> element\n```\n","_attachments":{},"homepage":"https://github.com/sodatea/get-current-script#readme","bugs":{"url":"https://github.com/sodatea/get-current-script/issues"},"license":"MIT"}