Added KeyCombo.progress.

This commit is contained in:
Richard Davey 2017-02-21 23:51:18 +00:00
parent fa69035e4f
commit 226e0b216d

View file

@ -4,7 +4,7 @@ var ProcessKeyCombo = require('./ProcessKeyCombo');
var KeyComboMatchEvent = require('./KeyComboMatchEvent');
// Keys can be either:
//
//
// A string (ATARI)
// An array of either integers (key codes) or strings, or a mixture of both
// An array of objects (such as Key objects) with a public 'keyCode' property
@ -123,4 +123,20 @@ KeyCombo.prototype = {
};
Object.defineProperties(KeyCombo.prototype, {
progress: {
enumerable: true,
// How far complete is this combo? A value between 0 and 1.
get: function ()
{
return this.index / this.size;
}
}
});
module.exports = KeyCombo;