Я вызываю функцию asyn c из плагина cordova. Однако ожидание на самом деле не работает.
export class MationLiteService implements IgatewayService {
async getGroupAllInfo(gatewayId: string, account: string, decryptedpasswd: string) {
// some codes
return await cordova.plugins.MationPlugin.getGroupAllInfo(data, async (response) => {
const json: JSON = JSON.parse(response);
console.log('responseaaaaa:' + response);
return json;
}, (error) => {
console.log('error: ' + error);
});
}
}
вот класс менеджера шлюза
export class GatewayManagerService {
public getGroupAllInfo(gatewayType: string, gatewayId: string, account: string, decryptedpasswd: string) {
return this.gatewayFactoryService.getGateway(gatewayType).getGroupAllInfo(gatewayId, account, decryptedpasswd);
}
}
вот как я его называю
async getAllInfo2(){
this.facadaService.GetGatewayManagerService().getGroupAllInfo('mation-lite', this.zifan, 'admin', '5555').then((response) => {
console.log(response);
});
//await this.facadaService.GetGatewayManagerService().test('mation-lite');
}
это дало мне не определено, когда я пытаюсь напечатать ответ.