mirror of
https://github.com/zkitter/eth-json-rpc-filters.git
synced 2026-01-08 23:08:10 -05:00
31 lines
645 B
JavaScript
31 lines
645 B
JavaScript
const BaseFilter = require('./base-filter')
|
|
|
|
// tracks all results ever recorded
|
|
class BaseFilterWithHistory extends BaseFilter {
|
|
|
|
constructor () {
|
|
super()
|
|
this.allResults = []
|
|
}
|
|
|
|
async update () {
|
|
throw new Error('BaseFilterWithHistory - no update method specified')
|
|
}
|
|
|
|
addResults (newResults) {
|
|
this.allResults = this.allResults.concat(newResults)
|
|
super.addResults(newResults)
|
|
}
|
|
|
|
addInitialResults (newResults) {
|
|
this.allResults = this.allResults.concat(newResults)
|
|
super.addInitialResults(newResults)
|
|
}
|
|
|
|
getAllResults () {
|
|
return this.allResults
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = BaseFilterWithHistory |