Skip to content

Commit 2966206

Browse files
StenALsaschanaz
andauthored
Add overloads for specific context types to OffscreenCanvas.getContext (#1474)
Co-authored-by: saschanaz <[email protected]>
1 parent 8246ebe commit 2966206

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

baselines/dom.generated.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10560,6 +10560,10 @@ interface OffscreenCanvas extends EventTarget {
1056010560
*
1056110561
* Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
1056210562
*/
10563+
getContext(contextId: "2d", options?: any): OffscreenCanvasRenderingContext2D | null;
10564+
getContext(contextId: "bitmaprenderer", options?: any): ImageBitmapRenderingContext | null;
10565+
getContext(contextId: "webgl", options?: any): WebGLRenderingContext | null;
10566+
getContext(contextId: "webgl2", options?: any): WebGL2RenderingContext | null;
1056310567
getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null;
1056410568
/** Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. */
1056510569
transferToImageBitmap(): ImageBitmap;

baselines/serviceworker.generated.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,6 +2512,10 @@ interface OffscreenCanvas extends EventTarget {
25122512
*
25132513
* Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
25142514
*/
2515+
getContext(contextId: "2d", options?: any): OffscreenCanvasRenderingContext2D | null;
2516+
getContext(contextId: "bitmaprenderer", options?: any): ImageBitmapRenderingContext | null;
2517+
getContext(contextId: "webgl", options?: any): WebGLRenderingContext | null;
2518+
getContext(contextId: "webgl2", options?: any): WebGL2RenderingContext | null;
25152519
getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null;
25162520
/** Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. */
25172521
transferToImageBitmap(): ImageBitmap;

baselines/sharedworker.generated.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,10 @@ interface OffscreenCanvas extends EventTarget {
24202420
*
24212421
* Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
24222422
*/
2423+
getContext(contextId: "2d", options?: any): OffscreenCanvasRenderingContext2D | null;
2424+
getContext(contextId: "bitmaprenderer", options?: any): ImageBitmapRenderingContext | null;
2425+
getContext(contextId: "webgl", options?: any): WebGLRenderingContext | null;
2426+
getContext(contextId: "webgl2", options?: any): WebGL2RenderingContext | null;
24232427
getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null;
24242428
/** Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. */
24252429
transferToImageBitmap(): ImageBitmap;

baselines/webworker.generated.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,6 +2607,10 @@ interface OffscreenCanvas extends EventTarget {
26072607
*
26082608
* Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
26092609
*/
2610+
getContext(contextId: "2d", options?: any): OffscreenCanvasRenderingContext2D | null;
2611+
getContext(contextId: "bitmaprenderer", options?: any): ImageBitmapRenderingContext | null;
2612+
getContext(contextId: "webgl", options?: any): WebGLRenderingContext | null;
2613+
getContext(contextId: "webgl2", options?: any): WebGL2RenderingContext | null;
26102614
getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null;
26112615
/** Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. */
26122616
transferToImageBitmap(): ImageBitmap;

inputfiles/overridingTypes.jsonc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,20 @@
11361136
}
11371137
}
11381138
},
1139+
"OffscreenCanvas": {
1140+
"methods": {
1141+
"method": {
1142+
"getContext": {
1143+
"additionalSignatures": [
1144+
"getContext(contextId: \"2d\", options?: any): OffscreenCanvasRenderingContext2D | null",
1145+
"getContext(contextId: \"bitmaprenderer\", options?: any): ImageBitmapRenderingContext | null",
1146+
"getContext(contextId: \"webgl\", options?: any): WebGLRenderingContext | null",
1147+
"getContext(contextId: \"webgl2\", options?: any): WebGL2RenderingContext | null"
1148+
]
1149+
}
1150+
}
1151+
}
1152+
},
11391153
"BeforeUnloadEvent": {
11401154
"properties": {
11411155
"property": {

0 commit comments

Comments
 (0)