Adding a Private property to CanvasRenderingContext2D
I am trying to extend CanvasRenderingContext2D to add a few more methods. I know that it’s not a simple matter of using extends because, apparently CanvasRenderingContext2D doesn’t permit normal construction. I found the technique at How to extend CanvasRenderingContext2D (in ES6-style scripts, if possible) . I have that working well enough, but I now want to add a private method. I can’t get that working at all using the normal technique. Here is an unsuccessful test script: class Context2D extends CanvasRenderingContext2D { constructor(context) { Object.setPrototypeOf(context, new.target.pro
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.