feature: add native context types

This commit is contained in:
gloryyin
2022-10-08 02:50:32 +08:00
parent c7857d7e2b
commit 4e89618a78
2 changed files with 10 additions and 5 deletions

View File

@@ -86,7 +86,7 @@ var CONTEXT_PROPERTIES = [
'globalAlpha',
'globalCompositeOperation',
'imageSmoothingEnabled',
];
] as const;
const traceArrMax = 100;
/**
@@ -701,6 +701,11 @@ export class Context {
}
}
// supported context properties
type CanvasContextProps = Pick<CanvasRenderingContext2D, typeof CONTEXT_PROPERTIES[number]>;
export interface Context extends CanvasContextProps {};
CONTEXT_PROPERTIES.forEach(function (prop) {
Object.defineProperty(Context.prototype, prop, {
get() {