godotjs / godotjs/javascript

Global pollution

Đang mở
#187 3 bình luận 7 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
C++
Star
1.1k
Fork
80
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Xem xét cách namespace toàn cục godot hiện tại được cung cấp, sau đó kiểm tra tệp tài liệu d.ts được đề xuất và các điểm vào của hệ thống module JavaScript. Xác nhận cú pháp import dự kiến với ví dụ Node2D và print, đồng thời coi việc loại bỏ đăng ký toàn cục trong khi vẫn giữ nguyên Godot API là Definition of Done.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, typescript
Lĩnh vực
api, developer-experience
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.