godotjs / godotjs/javascript

Global pollution

Offen
#187 3 Kommentare 7 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
C++
Sterne
1.1k
Forks
80
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.