phaser4-rex-plugins
Version:
18 lines (16 loc) • 475 B
JavaScript
var CreateProxyContext = function (config, baseContext) {
if (!config.hasOwnProperty('has')) {
throw 'Need has(target, key):boolean handler';
}
if (!config.hasOwnProperty('get')) {
throw 'Need get(target, key):any handler';
}
if (baseContext === undefined) {
baseContext = {};
}
return new Proxy(baseContext, {
has: config.has,
get: config.get
});
}
export default CreateProxyContext;