mirror of
https://github.com/eleith/emailjs.git
synced 2024-07-05 20:10:37 +00:00
fix type references
This commit is contained in:
parent
b22f8efa31
commit
f07f631e4b
@ -146,11 +146,8 @@ class Client {
|
||||
|
||||
message.valid((valid, why) => {
|
||||
if (valid) {
|
||||
/**
|
||||
* @type {MessageStack}
|
||||
*/
|
||||
const stack = {
|
||||
message: message,
|
||||
message,
|
||||
to: addressparser(message.header.to),
|
||||
from: addressparser(message.header.from)[0].address,
|
||||
callback: (callback || function() {}).bind(this),
|
||||
|
@ -234,7 +234,7 @@ class Message {
|
||||
* @property {string} [charset]
|
||||
* @property {string} [method]
|
||||
* @property {string} [path]
|
||||
* @property {Duplex} [stream]
|
||||
* @property {NodeJS.ReadWriteStream} [stream]
|
||||
* @property {boolean} [inline]
|
||||
* @property {MessageAttachment} [alternative]
|
||||
* @property {MessageAttachment[]} [related]
|
||||
|
@ -1,9 +1,10 @@
|
||||
const SMTPError = require('./error');
|
||||
const { TLSSocket } = require('tls');
|
||||
|
||||
class SMTPResponse {
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Socket | TLSSocket} stream the open socket to stream a response from
|
||||
* @param {NodeJS.Socket | TLSSocket} stream the open socket to stream a response from
|
||||
* @param {number} timeout the time to wait (in milliseconds) before closing the socket
|
||||
* @param {Function} onerror the function to call on error
|
||||
*/
|
||||
@ -104,26 +105,30 @@ class SMTPResponse {
|
||||
*/
|
||||
this.stop = err => {
|
||||
stream.removeAllListeners('response');
|
||||
stream.removeListener('data', watch);
|
||||
stream.removeListener('end', end);
|
||||
stream.removeListener('close', close);
|
||||
stream.removeListener('error', error);
|
||||
if (stream instanceof TLSSocket) {
|
||||
stream.removeListener('data', watch);
|
||||
stream.removeListener('end', end);
|
||||
stream.removeListener('close', close);
|
||||
stream.removeListener('error', error);
|
||||
}
|
||||
|
||||
if (err != null && typeof onerror === 'function') {
|
||||
onerror(err);
|
||||
}
|
||||
};
|
||||
|
||||
stream.on('data', watch);
|
||||
stream.on('end', end);
|
||||
stream.on('close', close);
|
||||
stream.on('error', error);
|
||||
stream.setTimeout(timeout, timedout);
|
||||
if (stream instanceof TLSSocket) {
|
||||
stream.on('data', watch);
|
||||
stream.on('end', end);
|
||||
stream.on('close', close);
|
||||
stream.on('error', error);
|
||||
stream.setTimeout(timeout, timedout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Socket | TLSSocket} stream the open socket to stream a response from
|
||||
* @param {NodeJS.Socket | TLSSocket} stream the open socket to stream a response from
|
||||
* @param {number} timeout the time to wait (in milliseconds) before closing the socket
|
||||
* @param {Function} onerror the function to call on error
|
||||
* @returns {SMTPResponse} the smtp response
|
||||
|
Loading…
Reference in New Issue
Block a user