proxy-vir
v2.0.0
Published
An easier Proxy.
Downloads
116,452
Readme
proxy-vir
Creates a proxy based on multiple dynamically cascaded targets (meaning you can add or remove targets whenever you want) with dynamic proxy handler overriding (meaning you can modify how proxy handlers operate after the proxy has been created).
Installation
npm i proxy-vir
Usages
Simple override
import {createWrappedMultiTargetProxy} from 'proxy-vir';
// something you imported from a 3rd party library that you want to wrap
const importedThing = {
doThingA() {},
};
const thingWrapper = createWrappedMultiTargetProxy({
initialTarget: importedThing,
});
// add a new override
thingWrapper.proxyModifier.addOverrideTarget({
doThingA() {},
});