Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Rename AppBase to App and deprecate Application

Đang mở
#9,502 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
50/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, typescript

Hướng nghiên cứu

Find the AppBase and Application class definitions in the codebase, likely in src/framework/application/. Understand how aliases and deprecation warnings are implemented elsewhere (look for Debug.deprecated). Update JSDoc links and examples to reference 'App'. Test that the alias works and deprecation warnings appear.

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

Mô tả

enhancement V3

Summary

Rename AppBase to App and deprecate both AppBase and Application, so users migrate once, from either old name straight to App.

Motivation

Application has a limitation that can't be fixed. Its constructor is synchronous, so it cannot create a WebGPU device, which requires awaiting createGraphicsDevice. Its JSDoc already tells new code to prefer AppBase and says the class is expected to be deprecated.

First-party code has already moved off it. web-components, supersplat, supersplat-viewer, model-viewer, the Editor and the engine examples (~280 files) all use AppBase. Nothing in the engine repo constructs Application apart from its own definition.

AppBase is the wrong public name. The Base suffix suggests an abstract class meant for subclassing, but it's the class we tell everyone to create an instance of. App is short and easy to guess, and it matches the app variable used everywhere (this.app, pc.app).

Deprecating Application alone would mean migrating twice. Users would move from Application to AppBase now and then again later. The rename and the deprecation should ship in the same release.

Proposal

Next minor release
  • Add App as the real class (today's AppBase).
  • Keep AppBase as an alias of the same class object, not a subclass, so static methods such as AppBase.getApplication() and instanceof checks keep working.
  • Deprecate AppBase and Application with Debug.deprecated warnings.
  • Do not add a convenience factory on App itself. A static such as App.create() would make App import every component system and resource handler, so no app could tree-shake them. Whether to offer an all-in helper at all is an open question below.
  • Update the JSDoc (~85 {@link AppBase} references), examples and first-party repos to App.
V3
  • Remove AppBase and Application. App is the permanent name.
  • Don't reuse the name Application. Giving an old name a new constructor would silently break existing new Application(canvas, { mouse }) code. Whether V3 keeps a stub that throws a message pointing to App can be decided when V3 is closer.

Out of scope

  • Collapsing the constructor-then-init() pattern into a single step. It's worth discussing, but it's a separate change.

Open questions

  • Do Editor-published builds (the published start script and the launcher) still construct pc.Application? This needs checking before we commit to removing it in V3.
  • Do we want an all-in async helper at all? If so, it must be a standalone export in its own module (e.g. createApp(canvas, options)), so that only apps that call it pay for the full engine. That is the same trade Application makes today, but WebGPU-capable. The alternative is no helper: the docs and examples show the explicit App setup, which is ~30 lines today (device, AppOptions with systems and handlers, SoundManager, Lightmapper, BatchManager, XrManager).

Related

  • #9086 (complete deprecated API refactoring and remove deprecated.js)
Ngôn ngữ chính
JavaScript
Star
16.8k
Fork
2k
Merge trung bình
2 giờ 53 phút
Pull request đã merge (30 ngày)
292

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của playcanvas/engine

Tất cả issue của playcanvas/engine

Issue tương tự

Thêm issue về JavaScript

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.