mirror of
https://github.com/nodejs/node.git
synced 2025-05-18 19:31:09 +00:00

PR-URL: https://github.com/nodejs/node/pull/3310 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
22 lines
395 B
JavaScript
22 lines
395 B
JavaScript
'use strict'
|
|
var validate = require('aproba')
|
|
var log = require('npmlog')
|
|
|
|
var pulsers = 0
|
|
var pulse
|
|
|
|
module.exports = function (prefix, cb) {
|
|
validate('SF', [prefix, cb])
|
|
if (!pulsers++) {
|
|
pulse = setInterval(function () {
|
|
log.gauge.pulse('network')
|
|
}, 250)
|
|
}
|
|
return function () {
|
|
if (!--pulsers) {
|
|
clearInterval(pulse)
|
|
}
|
|
cb.apply(null, arguments)
|
|
}
|
|
}
|