это файл EventSubscrbie js.
'use strict';
const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection;
class SubscribeEvent{
constructor() {
this.NetworkConnection = new BusinessNetworkConnection();
this.CONNECTION_PROFILE_NAME = "admin@resumenetwork";
}
init() {
return this.NetworkConnection.connect(this.CONNECTION_PROFILE_NAME)
.then((result) => {
this.businessNetworkDefinition = result;
//LOG.info(this.businessNetworkDefinition.getIdentifier());
})
// and catch any exceptions that are triggered
.catch(function (error) {
throw error;
});
}
/** Listen for the sale transaction events
*/
listen(){
this.NetworkConnection.on('event',(getEvent)=>{
var temp = JSON.stringify(getEvent['txForUser']);
var evt = JSON.parse(temp);
console.log(evt['certificateName']);
console.log(evt['certificateScore']);
console.log(evt['organizationId']);
console.log(evt['organizationName']);
console.log(evt['dob']);
console.log(evt['expirationDate']);
console.log(evt['isPublic']);
console.log(evt['userId']);
console.log(evt['timestamp']);
});
}
}
module.exports = SubscribeEvent;
Я хочу использовать код в компоненте angular4.
поэтому я вставляю модуль BusinessNetworkConnection.
В файле ts компонента,
import { BusinessNetworkConnection } from 'composer-client';
export class test {
var businessnetworkconnection = BusinessNetworkConnection();
}
как результат, предупреждающее сообщение
ПРЕДУПРЕЖДЕНИЕ в ./~/composer-common/lib/connectionprofilemanager.js
132: 57-69 Критическая зависимость: запрос зависимости является
выражение
ПРЕДУПРЕЖДЕНИЕ в ./~/composer-common/lib/log/logger.js 422: 27-35 Критическое
Зависимость: запрос зависимости является выражением
ПРЕДУПРЕЖДЕНИЕ в ./~/composer-common/lib/log/logger.js 618: 23-39 Критическое
Зависимость: запрос зависимости является выражением
ПРЕДУПРЕЖДЕНИЕ в ./~/composer-common/lib/config/configmediator.js 44: 27-35
Критическая зависимость: запрос зависимости является выражением
ПРЕДУПРЕЖДЕНИЕ в ./~/composer-common/lib/module/loadModule.js 71: 25-43
Критическая зависимость: запрос зависимости является выражением
и то же предупреждение было отображено на моей угловой веб-странице
весь модуль зависимости уже установлен.