https://github.com/t2ym/thin-trap
Thin ES6 Proxy Wrapper for Better Transparency
https://github.com/t2ym/thin-trap
Last synced: over 1 year ago
JSON representation
Thin ES6 Proxy Wrapper for Better Transparency
- Host: GitHub
- URL: https://github.com/t2ym/thin-trap
- Owner: t2ym
- License: other
- Created: 2017-01-16T06:27:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-17T13:16:01.000Z (over 9 years ago)
- Last Synced: 2025-03-09T10:42:18.154Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/thin-trap)
[](https://customelements.io/t2ym/thin-trap/)
# thin-trap
Thin ES6 Proxy Wrapper for Better Transparency (experimental)
```javascript
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
```sh
bower install --save thin-trap
```
### NodeJS
```sh
npm install --save thin-trap
```
## Import
### Browsers
```html
```
### NodeJS
```javascript
const trap = require('thin-trap/trap.js');
```
## API
TBD
## License
[BSD-2-Clause](https://github.com/t2ym/thin-trap/blob/master/LICENSE.md)