Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (Offscreen)RenderingContext protocols #45

Merged
merged 2 commits into from Jun 17, 2022

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Jun 17, 2022

Previously, RenderingContext and OffscreenRenderingContext were enums, which required the (only) module containing these enum declarations to know all possible context types upfront. When these types are declared as protocols, separate modules can add new types and add conformances to this protocol on case-by-case basis.

In a future PR this allows us to split Canvas, WebGL1, WebGL2, and WebGPU APIs into separate modules.

I've also made getContext calls type safe, where users now pass the type of desired context instead of their IDs.

@MaxDesiatov MaxDesiatov added the enhancement New feature or request label Jun 17, 2022
@MaxDesiatov MaxDesiatov requested a review from a team June 17, 2022 09:44
@MaxDesiatov MaxDesiatov merged commit 19229a9 into main Jun 17, 2022
@MaxDesiatov MaxDesiatov deleted the maxd/rendering-context-protocol branch June 17, 2022 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants