-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I'm trying to develop a toast UI editor plugin that uses alphaTex to visualize guitar tabs.
And I found that when I use alphaTab in a Javascript module,
I get an exception: "Cannot read properties of null (reading 'src')" when initializing alphaTab,
and then the initialization process is interrupted.
Expected Behavior
Because there's no "document.currentScript" in javascript module environment,
it would be safer to have null check on document.currentScript before returning document.currentScript.src.
So the initialization process won't be blocked due to the problem.
Steps To Reproduce
- create a javascript module
- import alphaTab
- run the script
- see the exception in console log
Link to jsFiddle, CodePen, Project
https://jsfiddle.net/yshlin/fo0pL65u/10/
Found in Version
1.2
Platform
Web
Environment
- **OS**: macOS 11.6
- **Browser**: Chrome 94.0.4606.61Anything else?
Still seeing the problem on the develop branch:
https://github.com/CoderLine/alphaTab/blob/develop/src/Environment.ts#L235
I was able to get my code to work after fixing this line.