UNPKG

ps2census

Version:

Client to connect to the PS2 Event Stream websocket.

21 lines 721 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DuplicateFilter = void 0; const decaying_set_1 = require("./decaying-set"); class DuplicateFilter { constructor({ decay = 2000, partitions = 8, ignore = ['GainExperience'], } = {}) { this.ignore = ignore; this.cache = new decaying_set_1.DecayingSet(partitions, decay); } filter(event) { if (this.ignore.includes(event.event_name)) return false; const hash = event.toHash(); if (this.cache.has(hash)) return true; this.cache.add(hash); return false; } } exports.DuplicateFilter = DuplicateFilter; //# sourceMappingURL=duplicate-filter.js.map