"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/utils/pulse-till-done.js" (8 Mar 2017, 426 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 'use strict'
    2 var validate = require('aproba')
    3 var log = require('npmlog')
    4 
    5 var pulsers = 0
    6 var pulse
    7 
    8 module.exports = function (prefix, cb) {
    9   validate('SF', [prefix, cb])
   10   if (!prefix) prefix = 'network'
   11   if (!pulsers++) {
   12     pulse = setInterval(function () {
   13       log.gauge.pulse(prefix)
   14     }, 250)
   15   }
   16   return function () {
   17     if (!--pulsers) {
   18       clearInterval(pulse)
   19     }
   20     cb.apply(null, arguments)
   21   }
   22 }