thin-trap
v0.0.2
Published
Thin ES6 Proxy Wrapper for Better Transparency
Downloads
2
Readme
thin-trap
Thin ES6 Proxy Wrapper for Better Transparency (experimental)
window.XMLHttpRequest = trap(window.XMLHttpRequest,
function loggerForwarder(trapName, args, target, outerProxy, thisArg, proxyForThis) {
console.log('trap:', trapName, args,
'for', (typeof target === 'function' ? target.name : target),
'thisArg', (thisArg && thisArg.name ? thisArg.name : thisArg));
return Reflect[trapName](...args);
}
);
Install
Browsers
bower install --save thin-trap
NodeJS
npm install --save thin-trap
Import
Browsers
<script src="path/to/bower_components/thin-trap/trap.js"></script>
NodeJS
const trap = require('thin-trap/trap.js');
API
TBD