
Wenn ich document.createElement('canvas').toDataURL() aufrufe, rufe ich die überschriebene Methode erfolgreich auf.
Code: Select all
// Tried both methods of overriding, but obviously the real question is about the `instanceof` values in the image above.
HTMLCanvasElement.prototype.toDataURL = new Proxy(HTMLCanvasElement.prototype.toDataURL, {
apply(target, self, args) {
return Reflect.apply(target, self, args);
},
});
// and...
HTMLCanvasElement.prototype.toDataURL = () => {
// do stuff here
};