mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
Use @types/node@8.0.0 to validate (and fix) small node 8 api issues
This commit is contained in:
parent
916d03f879
commit
f0a24b8f65
9 changed files with 49 additions and 43 deletions
|
|
@ -182,7 +182,8 @@ class Core extends EventEmitter {
|
|||
|
||||
/**
|
||||
* @template T
|
||||
* @param {function(Socket):Promise<T>} fn
|
||||
* @param {function(NodeJS.Socket):Promise<T>} fn
|
||||
* @param {number=} port
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
async withTcp(fn, port) {
|
||||
|
|
@ -236,7 +237,7 @@ class Core extends EventEmitter {
|
|||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Socket} socket
|
||||
* @param {NodeJS.Socket} socket
|
||||
* @param {Buffer|string} buffer
|
||||
* @param {function(Buffer):T} ondata
|
||||
* @returns Promise<T>
|
||||
|
|
@ -250,7 +251,7 @@ class Core extends EventEmitter {
|
|||
received = Buffer.concat([received, data]);
|
||||
const result = ondata(received);
|
||||
if (result !== undefined) {
|
||||
socket.off('data', onData);
|
||||
socket.removeListener('data', onData);
|
||||
resolve(result);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue