Closed chrsr closed 10 years ago
Hi Chris, thanks for the PR, but I want to keep nanobar as a one method function, as minimal as possible.
You can extend nanobar prototype:
var Nanobar = require( 'nanobar' ),
nanobar;
Nanobar.prototype.increase = function (p) {
p = p + this.bars[0].width;
p = p > 100 ? 100 : p;
this.go( p );
};
nanobar = new Nanobar();
nanobar.increase( 20 );
No dramas - that's pretty much how I extended it on my project.
I recently used nanobar on a project and found the need to increase it's width by a percentage rather than just moving it to a specific value. To do this I created a simple increase method that just adds the increase on to the existing width.
Example usage:
This pull request includes the code and updated demo + docs.