fix bars
This commit is contained in:
parent
76aa1addb8
commit
22d0e023ee
|
@ -1,12 +1,13 @@
|
|||
|
||||
const normal = '▒'
|
||||
const crazy = '▇'
|
||||
export default (valuefn=(ary)=>ary.length, threshold=100, yellowbox=false)=>events=>events.do(
|
||||
(infoAry)=>{
|
||||
const len = valuefn(infoAry)
|
||||
if(yellowbox && len >= threshold){
|
||||
console.warn(`bars: event rate over threshold (${threshold}): ${len}`)
|
||||
const normal = '▒';
|
||||
const crazy = '▇';
|
||||
export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false) => events => events.do(
|
||||
infoAry => {
|
||||
const len = valuefn(infoAry);
|
||||
if (yellowbox && len >= threshold) {
|
||||
console.warn(`bars: event rate over threshold (${threshold}): ${len}`);
|
||||
}
|
||||
console.log("tick", (len >= threshold ? crazy : normal).repeat(Math.floor(Math.log(Math.max(len,1)))) + `(${len})`)
|
||||
console.log('tick', (len >= threshold ?
|
||||
crazy
|
||||
: normal).repeat(Math.floor(Math.log(Math.max(len, 1)))) + `(${len})`);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
|
@ -4,13 +4,11 @@ import 'rxjs/add/operator/filter';
|
|||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/bufferTime';
|
||||
|
||||
import { spy as log } from '../log'
|
||||
|
||||
class Stream {
|
||||
constructor (emitter) {
|
||||
this.events = Observable.fromEvent(emitter, 'mqspy')
|
||||
this.spy = (info) => emitter.emit('mqspy', info)
|
||||
this.events = Observable.fromEvent(emitter, 'mqspy');
|
||||
this.spy = info => emitter.emit('mqspy', info);
|
||||
}
|
||||
}
|
||||
|
||||
export default Stream
|
||||
export default Stream;
|
||||
|
|
Loading…
Reference in New Issue