Sha256: 7f33da3c7c88af207dffa261edf9ac92cd512c1ae61fd7c338cbd22fe8ebaa12
Contents?: true
Size: 658 Bytes
Versions: 26
Compression:
Stored size: 658 Bytes
Contents
'use strict'; 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'); } // Fall back to getting all scripts in the document. var scriptElements = document.scripts || []; var currentScript = scriptElements[scriptElements.length - 1]; if (currentScript) { return currentScript.getAttribute('src'); } // Fail as there was no script to use. throw new Error('[WDS] Failed to get current script source.'); } module.exports = getCurrentScriptSource;
Version data entries
26 entries across 25 versions & 8 rubygems