JSFiddle - React, Tailwind, and code Playground
JavaScript
var context = Object.getPrototypeOf(CanvasRenderingContext2D);
for (var i in context) {
(function(i) {
var original = context[i];
context[i] = function() {
console.log(i, arguments);
return original.apply(this, arguments);
}
}).call(context[i], i);
}
ctx = document.getElementsByTagName('canvas')[0].getContext('2d');
// Filled triangle
ctx.beginPath();
ctx.moveTo(25, 25);
ctx.lineTo(105, 25);
ctx.lineTo(25, 105);
ctx.fill();
// Stroked triangle
ctx.beginPath();
ctx.moveTo(125, 125);
ctx.lineTo(125, 45);
ctx.lineTo(45, 125);
ctx.closePath();
ctx.stroke();