Alright first I'll say I'm using FF to test because FF supports proxies, and I really don't know how to use Reflect and how it works yet. FF as well does not support Reflect right now. Therefore I'll look into that.
So from [this source]( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/apply#Interceptions) it seems that it would only work if the actual proxy is invoked as a function? Take a look at the example in that link as well. Now I'm not sure if Reflect changes that somehow. **BTW** When I ran the code, I didn't get an `Error` saying that `Reflect` is not defined I got: `TypeError: people.logFullName is not a function` So I don't think that worked. On Tue, Jun 9, 2015 at 3:39 AM, Claude Pache <claude.pa...@gmail.com> wrote: > > Le 9 juin 2015 à 07:58, Edwin Reynoso <eor...@gmail.com> a écrit : > > > **Or does someone know how to do what I'm trying to accomplish** > > > Maybe the following code goes in the direction of what you want? > > ```js > var people = new Proxy([new Person('Edwin', 'Reynoso'), new Person('That', > 'Guy')], { > get(target, property) { > if (target[property] !== undefined) > return target[property]; > var arr = []; > for (var person of target) arr.push(person[property]); > return new Proxy(arr, { > apply(target, thisArg, args) { > return target.map(item => Reflect.apply(item, thisArg, args)) > } > }) > } > }); > ``` > > About your proposal, I recall that, at some point in the history of ES6 > draft, there was an `[[Invoke]]` MOP, and a corresponding `invoke` trap for > proxies, that were finally eliminated. > > —Claude >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss