Durante a aula o instrutor utiliza a instrução no get do proxy:
return acao(target);
já no set ele não utiliza o "return".
Qual a função dessa instrução? Não ficou mt clara pra mim.
Código completo:
get(target, prop, receiver) {
if(props.includes(prop) && ProxyFactory._ehFuncao(target[prop])) {
return function() {
console.log(`a propriedade "${prop}" foi interceptada`);
Reflect.apply(target[prop], target, arguments);
return acao(target);
};
}
return Reflect.get(target, prop, receiver);
},
set(target, prop, value, receiver) {
if(props.includes(prop)) {
target[prop] = value;
acao(target);
}
return Reflect.set(target, prop, value, receiver);
}