···11+// Detect whether fallback version is needed
22+(function() {
33+44+ try {
55+ var fancyFunction = eval('async function* fancy() {}')
66+ } catch (e) {
77+ // Compute path to legacy library
88+ // (this could use document.currentScript, but sadly the
99+ // browsers that need this workaround don't support that)
1010+ var scriptTag = document
1111+ .querySelector('script[data-labjs-script="library"]')
1212+1313+ var scriptPath = scriptTag.src
1414+ .split('/').slice(0, -1).join('/') + '/lab.legacy.js'
1515+1616+ var script = document.createElement('script')
1717+ script.src = scriptPath
1818+1919+ // Load legacy library version in old browsers
2020+ // by inserting script tag after current library version
2121+ scriptTag.parentNode.insertBefore(script, scriptTag.nextSibling)
2222+ }
2323+2424+})();