Skip to content

Commit

Permalink
Add TypeScript type definitions file based on @types/gl.
Browse files Browse the repository at this point in the history
  • Loading branch information
null77 authored and dhritzkiv committed Jan 13, 2025
1 parent 22ffabe commit f038e77
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
declare namespace createContext {
interface STACKGL_destroy_context {
destroy(): void;
}

interface STACKGL_resize_drawingbuffer {
resize(width: GLint, height: GLint): void;
}

interface StackGLExtension {
getExtension(extensionName: "STACKGL_destroy_context"): STACKGL_destroy_context | null;
getExtension(extensionName: "STACKGL_resize_drawingbuffer"): STACKGL_resize_drawingbuffer | null;
}

const WebGLRenderingContext: WebGLRenderingContext & StackGLExtension & {
new(): WebGLRenderingContext & StackGLExtension;
prototype: WebGLRenderingContext & StackGLExtension;
};

const WebGL2RenderingContext: WebGL2RenderingContext & StackGLExtension & {
new(): WebGL2RenderingContext & StackGLExtension;
prototype: WebGL2RenderingContext & StackGLExtension;
};
}

declare function createContext(
width: number,
height: number,
options?: WebGLContextAttributes,
): WebGLRenderingContext & createContext.StackGLExtension;

export = createContext;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"server",
"gpgpu"
],
"types": "index.d.ts",
"author": "Mikola Lysenko",
"license": "BSD-2-Clause",
"gypfile": true
Expand Down

0 comments on commit f038e77

Please sign in to comment.