X7ROOT File Manager
Current Path:
/lib/node_modules/npm/node_modules/are-we-there-yet
lib
/
node_modules
/
npm
/
node_modules
/
are-we-there-yet
/
📁
..
📄
CHANGES.md
(1.08 KB)
📄
LICENSE
(733 B)
📄
README.md
(6.15 KB)
📄
index.js
(163 B)
📁
node_modules
📄
package.json
(1.62 KB)
📄
tracker-base.js
(274 B)
📄
tracker-group.js
(3.16 KB)
📄
tracker-stream.js
(943 B)
📄
tracker.js
(826 B)
Editing: 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) }
Upload File
Create Folder