JSFiddle - React, Tailwind, and code Playground

by t2t2

JavaScript

class OrigClass {
	constructor(test) {
  	this.test = test
    console.log('orig', test)
  }
  
  method(val) {
  	console.log('method', val)
  }
}

function PatchedClass() {
	console.log('patch before')
	const inst = new OrigClass(...arguments)
  console.log('path after')
  return inst
}

class ExtendedClass extends PatchedClass {
	constructor(test) {
  	super(test)
  }
  
  method(val) {
  	super.method('asd' + val)
  }
}

const inst = new ExtendedClass('asd')
inst.method(234)