// wrapper for match media
function media (q: string) {
	return function (target,method) {
		window.addEventListener("resize", () => {
			if (window.matchMedia("("+q+")").matches) {
				target[method]();
			}
		});
	}
}

//full usage
class Test {
	constructor() {
		this.doThis();
	}	
	
	@media("min-width: 400px")
	doThis() {
		console.log("MQ")
	}
}

new Test()
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.