/**
* Created by darius on 02/04/16.
*/
import { Component } from \'angular2/core\';
import { Observable } from \'rxjs/Rx\';
@Component({
styles: [ require(\'../..
I think that you could leverage the buffer operator. It allows to buffer events and sends them after an amount of time. You could then map this list of events to its length.
var source = Observable.fromEvent(document.body, 'keyup');
var obs = source
.bufferTime(1000).map((clickBuffer) => {
return clickBuffer.length;
});
obs.subscribe((num) => {
// Get the number of pressed keys per second
});
See these links: