fix(core): update
This commit is contained in:
parent
4e7c28ac83
commit
f2a85d4719
@ -49,7 +49,7 @@ export class ReactionRequest<T extends plugins.typedrequestInterfaces.ITypedRequ
|
|||||||
request: requestDataArg,
|
request: requestDataArg,
|
||||||
response: null
|
response: null
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
channel.sendMessage({
|
channel.sendMessage({
|
||||||
messageText: 'reactionRequest',
|
messageText: 'reactionRequest',
|
||||||
payload
|
payload
|
||||||
|
@ -16,11 +16,26 @@ export class ReactionResult<T extends plugins.typedrequestInterfaces.ITypedReque
|
|||||||
return this.resultSubject.subscribe(observerArg);
|
return this.resultSubject.subscribe(observerArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the end result as an array of all results
|
||||||
|
*/
|
||||||
public async getEndResult() {
|
public async getEndResult() {
|
||||||
const result = await this.completeDeferred.promise;
|
const result = await this.completeDeferred.promise;
|
||||||
return result;
|
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
|
* push a reactionResponse
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user