JSFiddle - React, Tailwind, and code Playground
by Konrad P
JavaScript
(function() {
'use strict';
console.clear();
//some empty class where I want to trap methods & props
class X {
}
let proxy = {
get: function(target, prop, receiver) {
console.log(arguments);//this gives the arguments of the 'get' trap itself.
//I know I can do this to play with arguments, but this doesn't solve my another problem.
/*
return function(...args) {
console.log('wrapper args:', args);
return 42;
}*/
},
};
let p = new Proxy(X, proxy);
console.log(p.test('some arg passed'));
})();