fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-17 12:46:35 +02:00
parent 4e7c28ac83
commit f2a85d4719
2 changed files with 16 additions and 1 deletions

View File

@ -49,7 +49,7 @@ export class ReactionRequest<T extends plugins.typedrequestInterfaces.ITypedRequ
request: requestDataArg,
response: null
}
}
};
channel.sendMessage({
messageText: 'reactionRequest',
payload

View File

@ -16,11 +16,26 @@ export class ReactionResult<T extends plugins.typedrequestInterfaces.ITypedReque
return this.resultSubject.subscribe(observerArg);
}
/**
* gets the end result as an array of all results
*/
public async getEndResult() {
const result = await this.completeDeferred.promise;
return result;
}
/**
* if there is a single respondant, or you are only interested in the first result
*/
public async getFirstResult() {
const done = plugins.smartpromise.defer<T['response']>();
const subscription = this.resultSubject.subscribe(result => {
done.resolve(result);
subscription.unsubscribe();
});
return await done.promise;
}
/**
* push a reactionResponse
*/