PHP 8.2.30
Preview: tracker.js Size: 826 B
/lib/node_modules/npm/node_modules/are-we-there-yet/tracker.js

'use strict'
var util = require('util')
var TrackerBase = require('./tracker-base.js')

var Tracker = module.exports = function (name, todo) {
  TrackerBase.call(this, name)
  this.workDone = 0
  this.workTodo = todo || 0
}
util.inherits(Tracker, TrackerBase)

Tracker.prototype.completed = function () {
  return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
}

Tracker.prototype.addWork = function (work) {
  this.workTodo += work
  this.emit('change', this.name, this.completed(), this)
}

Tracker.prototype.completeWork = function (work) {
  this.workDone += work
  if (this.workDone > this.workTodo) this.workDone = this.workTodo
  this.emit('change', this.name, this.completed(), this)
}

Tracker.prototype.finish = function () {
  this.workTodo = this.workDone = 1
  this.emit('change', this.name, 1, this)
}

Directory Contents

Dirs: 1 × Files: 9

Name Size Perms Modified Actions
- drwxr-xr-x 2024-03-03 22:36:28
Edit Download
1.08 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download
163 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
733 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
1.62 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download
6.15 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download
274 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
3.16 KB lrw-r--r-- 2021-03-10 14:36:37
Edit Download
943 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download
826 B lrw-r--r-- 2021-03-10 14:36:37
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).