Rename AppBase to App and deprecate Application
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
- Lĩnh vực
- backend-api-design, tooling
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ả
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
Appas the real class (today'sAppBase). - Keep
AppBaseas an alias of the same class object, not a subclass, so static methods such asAppBase.getApplication()andinstanceofchecks keep working. - Deprecate
AppBaseandApplicationwithDebug.deprecatedwarnings. - Do not add a convenience factory on
Appitself. A static such asApp.create()would makeAppimport 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 toApp.
V3
- Remove
AppBaseandApplication.Appis the permanent name. - Don't reuse the name
Application. Giving an old name a new constructor would silently break existingnew Application(canvas, { mouse })code. Whether V3 keeps a stub that throws a message pointing toAppcan 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 tradeApplicationmakes today, but WebGPU-capable. The alternative is no helper: the docs and examples show the explicitAppsetup, which is ~30 lines today (device,AppOptionswith 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của playcanvas/engine
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
playcanvas/engine#9574 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: gltf area: graphics
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
playcanvas/engine#9510 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Disable shape scaling by defaultĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
playcanvas/engine#9335 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: ui enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
playcanvas/engine#5777 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shadows: incorrect offset behavior under lightingCó thể đã có người làm @mvaligursky đã nhận 3 ngày trước. Đang mởarea: graphics
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
playcanvas/engine#9557 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của playcanvas/engine
Issue tương tự
-
Add google analyticsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
NCAR/music-box-interactive#628 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
remotion-dev/remotion#11847 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
phoenixframework/phoenix_live_view#4456 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
AllTheMods/ATM-10#4436 ·
Maintainer thường phản hồi trong vòng 5 ngày