-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global pollution #187
Comments
I think this is limited engine - C++ <-> JS, you can bind data into JS from C++ only in global object. Actually another languages with runtime has similar behaviour |
Hmm, I don't know what to say about this because I've already found libraries in C#, for example, that allowed running javascript engines and exporting objects as modules to be imported. So i dunno if there's a lib like that in C++ |
@Hadaward at the moment I'm not comfortable enough to do some changes at this point and I'm not sure if we can build an own object somehow. I personally don't like global pollution, as well. But there is some workaround for TS. You could create a new file
You need to map everything you need then you are able to use it as module for now. |
I personally don't really like global pollution, you could take advantage of the javascript module system to export godot methods, utilities and classes without needing to register the
godot
namespace into the global. If you are wondering how this would work, it is quite simple, the first thing needed would be a d.ts documentation file for intellisense to work. And then we can consume the godot api using import syntax:This is literally the only thing I dislike about this api, the godot api is simply thrown into the global scope.
The text was updated successfully, but these errors were encountered: