Buckets:
ktongue/docker_container / CAD_kevin /frontend /node_modules /webpack-dev-server /client /utils /getCurrentScriptSource.js
| /** | |
| * @returns {string} | |
| */ | |
| function getCurrentScriptSource() { | |
| // `document.currentScript` is the most accurate way to find the current script, | |
| // but is not supported in all browsers. | |
| if (document.currentScript) { | |
| return document.currentScript.getAttribute("src"); | |
| } | |
| // Fallback to getting all scripts running in the document. | |
| var scriptElements = document.scripts || []; | |
| var scriptElementsWithSrc = Array.prototype.filter.call(scriptElements, function (element) { | |
| return element.getAttribute("src"); | |
| }); | |
| if (scriptElementsWithSrc.length > 0) { | |
| var currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1]; | |
| return currentScript.getAttribute("src"); | |
| } | |
| // Fail as there was no script to use. | |
| throw new Error("[webpack-dev-server] Failed to get current script source."); | |
| } | |
| export default getCurrentScriptSource; |
Xet Storage Details
- Size:
- 868 Bytes
- Xet hash:
- 72edf4f41cce129206cb22faf0d5fb4771c91a6caba016f6af2bef8e0a5ab0c0
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.