Skip to content

Commit

Permalink
Adding fromEventOnce(eventName) method to the socket service, to supp…
Browse files Browse the repository at this point in the history
…ort one-time events and async/await operations
  • Loading branch information
bluzi committed Jun 16, 2017
1 parent d286330 commit d1450cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion socket-io.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@ export class WrappedSocket {
};
}).share();
}


/* Creates a Promise for a one-time event */
fromEventOnce<T>(eventName: string): Promise<T> {
return new Promise<T>(resolve => this.once(eventName, resolve));
}
}

0 comments on commit d1450cd

Please sign in to comment.