function A(cv, opts = {}) { this.B = new Proxy(new B(), { get: function(target, key) { if (typeof target[key] == "function") return target[key].bind(target); return target[key]; } });}function B() {}B.prototype = { b1: function(a, b, c, d) { return a + b + c + d; }, b2: function(type, ...data) { }}如題,請問一下使用es6中的Proxy代理B實例化的一個對象,如果使用es5來實現(xiàn)這個代理模式,如何實現(xiàn)呢?
ES6實現(xiàn)的下段代碼中的Proxy使用ES5如何實現(xiàn)呢?
阿晨1998
2018-12-20 18:14:23