git ssb

0+

Dominic / hyperprogress



Commit 84e8acd6b25c6a0ee91b1246f2cc39444d9ccad1

can reset the progress bar, incase you need to try something twice

Dominic Tarr committed on 7/24/2016, 12:24:13 PM
Parent: 2ba82fd391fcb12d40a521ed9a2c156d9426de3a

Files changed

index.jschanged
index.jsView
@@ -15,8 +15,9 @@
1515 var list = create('ul', 'hyperprogress__list')
1616 var error = create('pre', 'hyperprogress__error')
1717 var liquid = create('div', 'hyperprogress__liquid', ['.'])
1818 var bar = create('div', 'hyperprogress__bar', [liquid])
19+ liquid.style.width = '0%'
1920
2021 var n = 0
2122
2223 var prog = create('div', 'hyperprogress', [
@@ -27,9 +28,9 @@
2728 ])
2829
2930 prog.complete = function () {
3031 liquid.style.width = '100%'
31- progress.classList.add('hyperprogress--complete')
32+ prog.classList.add('hyperprogress--complete')
3233 }
3334
3435 prog.next = function (name) {
3536 n = Math.min(n+1, steps)
@@ -45,13 +46,22 @@
4546 prog.complete()
4647 }
4748
4849 prog.fail = function (err) {
49- progress.classList.add('hyperprogress--failed')
50+ prog.classList.add('hyperprogress--failed')
5051 list.lastChild.classList.add('hyperprogress--error')
5152 if(err && err.stack)
5253 error.textContent = err.stack
5354 }
5455
56+ prog.reset = function () {
57+ n = 0
58+ error.innerHTML = list.innerHTML = ''
59+ liquid.style.width = '0%'
60+ return prog
61+ }
62+
5563 return prog
5664 }
5765
66+
67+

Built with git-ssb-web