godotjs / godotjs/javascript

Global pollution

Aperta
#187 3 commenti 7 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
C++
Stelle
1.1k
Fork
80
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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:

```js
import { Node2D, print } from "godot";

export class Main extends Node2D {
_ready() {
print("Hi from Javascript Main class");
}
}
```

This is literally the only thing I dislike about this api, the godot api is simply thrown into the global scope.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.