• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var log = require('npmlog')
3var progressEnabled
4var running = 0
5
6var startRunning = exports.startRunning = function () {
7  if (progressEnabled == null) progressEnabled = log.progressEnabled
8  if (progressEnabled) log.disableProgress()
9  ++running
10}
11
12var stopRunning = exports.stopRunning = function () {
13  --running
14  if (progressEnabled && running === 0) log.enableProgress()
15}
16
17exports.tillDone = function noProgressTillDone (cb) {
18  startRunning()
19  return function () {
20    stopRunning()
21    cb.apply(this, arguments)
22  }
23}
24