qliproxy
v0.0.1
Published
Designed to help you work with JS Proxy with ease
Downloads
3
Readme
QliProxy
Designed to help you work with JS Proxy with ease.
Warning
This project is in the early stages of development! Please feel free to make a pull request :)
Getting Started
- To begin using QliProxy, make sure you have it installed
npm install qliproxy
- Next, import the submodule QliProxy using the appropriate syntax for your environment
CommonJS:
const {QliProxy} = require('qliproxy')
ES6:
import {QliProxy} from 'qliproxy'
- Begin using the proxy
import {QliProxy} from 'qliproxy'
const myProxyObject = new QliProxy({
get: ()=>12 // Our proxy will now return 12 for every property, no matter what the actual value is
})
To learn how to utilize your proxy object please see the section below
Proxy Options
| option | description | input | | -- | -- | -- | | get | intercepts properties being accessed | callback function | | set | intercepts properties being modified | callback function | | delete | intercepts properties being deleted | callback function | | object | allows you to provide a base object to initialize your proxy | object or function | | getKeys | intercepts and provides the keys when they're enumerated | callback function | | read | allows you to enable/disable the reading of properties | boolean | | write | allows you to enable/disable the modification of properties | boolean | | has | intercepts calls to hasOwnProperty and the in operator | callback function | | construct | intercepts constructor calls (applicable to classes only) | callback function | | execute | intercepts function execution (applicable to functions only) | callback function |