UNPKG

press-plus

Version:
28 lines (22 loc) 591 B
import type { PAGFile, } from './types'; const interceptor: any = { }; function createProxyPAGFile(originPAGFile: PAGFile): any { const proxyPAGFile = new Proxy(originPAGFile, { get(target, prop, receiver) { const value = interceptor[prop]; if (value instanceof Function) { return function (this: any, ...args: any[]) { return value.apply(this === receiver ? target : this, args); // 兼容this方式调用 }; } return Reflect.get(target, prop, receiver); }, }); return proxyPAGFile; } export { createProxyPAGFile, };