Arquivo package.json
{ "name": "client", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1", "build-dev": "webpack --config webpack.config.js", "build-prod": "cross-env NODE_ENV=production webpack --config webpack.config.js", "start": "webpack-dev-server" }, "author": "", "license": "ISC", "dependencies": { "bootstrap": "^3.3.7", "jquery": "^3.2.1", "reflect-metadata": "^0.1.10" }, "devDependencies": { "babel-core": "^6.25.0", "babel-loader": "^7.1.0", "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-preset-es2017": "^6.24.1", "babili-webpack-plugin": "^0.1.1", "cross-env": "^5.0.1", "css-loader": "^0.28.4", "cssnano": "^3.10.0", "extract-text-webpack-plugin": "^3.0.0", "file-loader": "^0.11.2", "html-webpack-plugin": "^2.29.0", "mini-css-extract-plugin": "^0.9.0", "optimize-css-assets-webpack-plugin": "^2.0.0", "style-loader": "^0.18.2", "uninstall": "0.0.0", "url-loader": "^0.5.9", "webpack": "^3.1.0", "webpack-cli": "^3.3.6", "webpack-dev-server": "^2.5.1" } }
Retirada as referencias estaticas da classe NegociacaoService e as instancia da mesma.
CLASSE NegociacaoController
@bindEvent('click', '#botao-importa') @debounce() async importaNegociacoes() {
try { const { NegociacaoService } = await System.import('../domain/negociacao/NegociacaoService');
const service = new NegociacaoService();
const negociacoes = await service.obtemNegociacoesDoPeriodo();
console.log(negociacoes);
negociacoes.filter(novaNegociacao =>
!this._negociacoes.paraArray().some(negociacaoExistente =>
novaNegociacao.equals(negociacaoExistente)))
.forEach(negociacao => this._negociacoes.adiciona(negociacao));
this._mensagem.texto = 'Negociações do período importadas com sucesso';
} catch (err) {
this._mensagem.texto = getExceptionMessage(err);
}
}