Sha256: 10abe0873555228627d7a4098aa104cb94fc609fc237c2061d6c25011dab0117

Contents?: true

Size: 826 Bytes

Versions: 85

Compression:

Stored size: 826 Bytes

Contents

'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)
}

Version data entries

85 entries across 52 versions & 18 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.18.0 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.18.0 test/dummy/node_modules/fsevents/node_modules/are-we-there-yet/tracker.js
disco_app-0.18.2 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.16.1 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.15.2 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.18.4 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.18.1 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.14.0 test/dummy/node_modules/are-we-there-yet/tracker.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/are-we-there-yet/tracker.js
tang-0.2.1 spec/tang_app/node_modules/are-we-there-yet/tracker.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/are-we-there-yet/tracker.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/are-we-there-yet/tracker.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/are-we-there-yet/tracker.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/are-we-there-yet/tracker.js
tang-0.2.0 spec/tang_app/node_modules/are-we-there-yet/tracker.js
tang-0.1.0 spec/tang_app/node_modules/are-we-there-yet/tracker.js
tang-0.0.9 spec/tang_app/node_modules/are-we-there-yet/tracker.js
enju_library-0.3.8 spec/dummy/node_modules/are-we-there-yet/tracker.js