Transcrypt
Transcrypt copied to clipboard
How to access a javscript library whose name includes '-'?
Hi,
I am trying to integrate a Javascript library whose name is 'babylon-htmlmesh'. As you can see, the name of the library includes '-' character. I found that Transcrypt mistranslated it adding a space character to both sides of '-' character.
python .py file:
api = __pragma__('js',
'{}',
'babylon-htmlmesh;'
)
Transcrypted .js file:
export var api = babylon - htmlmesh;
Note that '-' became ' - ' after Transcrypted above. Because of the added spaces, Javascript raises an error.
How can I access a javscript library whose name includes '-' in Transcrypt?
Thanks in advance.
I found a way:
api = __pragma__('js',
'{}',
#'babylon-htmlmesh;' # CAUTION: '-' is Transcrypted to ' - ' raising an error in Javacript
'window["babylon-htmlmesh"];'
)