这是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 关键依赖:依赖的请求是表达式
在我的角网页上显示了相同的警告信息
已经安装了所有依赖模块。
答案 0 :(得分:0)