Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro "Cannot read property 'negociacoes'"

Olá, estou com um problema na tag view, segue abaixo o erro:

Uncaught TypeError: Cannot read property 'negociacoes' of undefined
    at NegociacoesView.template (NegociacoesView.js:22)
    at NegociacoesView.update (View.js:14)
    at new NegociacaoController (NegociacaoController.js:15)
    at index.html:59

Por algum motivo estou tendo um erro quando tento fazer um map no negociacoesView. Acredito que o problema esteja na instancia de "_listaNegociacoes", mas não consigo identificá-lo. Segue abaixo a instância e o método "create" de "ProxyFactory":

this._listaNegociacoes = ProxyFactory.create(new ListaNegociacoes(), 
            ['adiciona', 'esvazia'],
            (model) => this._negociacoesView.update(model))
static create(objeto, props, acao){
        new Proxy(new ListaNegociacoes(), {

            get(target, prop, receiver) {

                if(props.includes(prop) && typeof(target[prop]) == typeof(Function)) {

                    return function() {

                        console.log(`interceptando ${prop}`);
                        let retorno = Reflect.apply(target[prop], target, arguments);
                        acao(target);
                        return retorno;
                    }
                }

                return Reflect.get(target, prop, receiver);
            }

        });
    }

Perdão por qualquer erro gramatical : )

1 resposta
solução!

Fala ai João, tudo bem? Acho que faltou dar um return da Proxy dentro da função create, ou seja:

static create(objeto, props, acao){
        return new Proxy
    // ...
}

Espero ter ajudado.