mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 19:25:26 -05:00
Simplify Client.roundtrip callback arg
This commit is contained in:
parent
619f1db08f
commit
06ca812d06
1 changed files with 4 additions and 8 deletions
|
@ -296,8 +296,7 @@ export default class Client extends EventTarget {
|
|||
who(mask) {
|
||||
var msg = { command: "WHO", params: [mask] };
|
||||
var l = [];
|
||||
return this.roundtrip(msg, (event) => {
|
||||
var msg = event.detail.message;
|
||||
return this.roundtrip(msg, (msg) => {
|
||||
switch (msg.command) {
|
||||
case irc.RPL_WHOREPLY:
|
||||
// TODO: match with mask
|
||||
|
@ -315,8 +314,7 @@ export default class Client extends EventTarget {
|
|||
whois(target) {
|
||||
var targetCM = this.cm(target);
|
||||
var msg = { command: "WHOIS", params: [target] };
|
||||
return this.roundtrip(msg, (event) => {
|
||||
var msg = event.detail.message;
|
||||
return this.roundtrip(msg, (msg) => {
|
||||
switch (msg.command) {
|
||||
case irc.RPL_ENDOFWHOIS:
|
||||
var nick = msg.params[1];
|
||||
|
@ -488,7 +486,7 @@ export default class Client extends EventTarget {
|
|||
return new Promise((resolve, reject) => {
|
||||
var handleMessage = (event) => {
|
||||
try {
|
||||
var result = done(event);
|
||||
var result = done(event.detail.message);
|
||||
if (result) {
|
||||
this.removeEventListener("message", handleMessage);
|
||||
resolve(result);
|
||||
|
@ -505,9 +503,7 @@ export default class Client extends EventTarget {
|
|||
}
|
||||
|
||||
fetchBatch(msg, batchType) {
|
||||
return this.roundtrip(msg, (event) => {
|
||||
var msg = event.detail.message;
|
||||
|
||||
return this.roundtrip(msg, (msg) => {
|
||||
switch (msg.command) {
|
||||
case "BATCH":
|
||||
var enter = msg.params[0].startsWith("+");
|
||||
|
|
Loading…
Reference in a new issue