1 | const net = require('net');
|
2 |
|
3 | const hasGrowl = false;
|
4 | module.exports = function(growlConfig, cb) {
|
5 | if (typeof cb === 'undefined') {
|
6 | cb = growlConfig;
|
7 | growlConfig = {};
|
8 | }
|
9 | if (hasGrowl) return cb(null, hasGrowl);
|
10 | const port = growlConfig.port || 23053;
|
11 | const host = growlConfig.host || 'localhost';
|
12 | const socket = net.connect(port, host);
|
13 | socket.setTimeout(100);
|
14 |
|
15 | socket.once('connect', function() {
|
16 | socket.end();
|
17 | cb(null, true);
|
18 | });
|
19 |
|
20 | socket.once('error', function() {
|
21 | socket.end();
|
22 | cb(null, false);
|
23 | });
|
24 | };
|