Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kaguya-anime/parsers

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kaguya-anime/parsers - npm Package Compare versions

Comparing version 1.12.1 to 1.13.0

8

build/core/Monitor.d.ts

@@ -0,1 +1,2 @@

import Scraper from './Scraper';
export declare const DEFAULT_MONITOR_INTERVAL = 1200000;

@@ -9,6 +10,9 @@ export default class Monitor {

oldData: any;
static queueList: Scraper[];
constructor(onRequest: () => Promise<any>, shouldChange: (oldData?: any, newData?: any) => Promise<boolean>);
onMonitorChange(): void;
run(): void;
onMonitorChange(): Promise<void>;
run(onRun: () => any): void;
check(): Promise<void>;
static addToQueue(parser: Scraper): void;
static runNextParser(): Promise<void>;
}

@@ -14,25 +14,49 @@ Object.defineProperty(exports, "__esModule", { value: true });

onMonitorChange() {
console.log('Method not implemented.');
return tslib_1.__awaiter(this, void 0, void 0, function* () {
console.log('Method not implemented.');
});
}
run() {
run(onRun) {
if (this.isDisabled)
return;
setInterval(this.check.bind(this), this.interval);
setInterval(onRun, this.interval);
}
check() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (this.isRequestDisabled) {
this.onMonitorChange();
return;
try {
if (this.isRequestDisabled) {
yield this.onMonitorChange();
return;
}
const data = yield this.onRequest();
const shouldChange = yield this.shouldChange(this.oldData, data);
if (shouldChange) {
yield this.onMonitorChange();
}
this.oldData = data;
}
const data = yield this.onRequest();
const shouldChange = yield this.shouldChange(this.oldData, data);
if (shouldChange) {
this.onMonitorChange();
catch (err) {
console.log('Monitor error');
}
this.oldData = data;
});
}
static addToQueue(parser) {
this.queueList.push(parser);
if (this.queueList.length === 1) {
this.runNextParser();
}
}
static runNextParser() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const parser = this.queueList[0];
yield parser.monitor.check();
this.queueList.shift();
if (this.queueList.length > 0) {
this.runNextParser();
}
});
}
}
exports.default = Monitor;
Monitor.queueList = [];
//# sourceMappingURL=Monitor.js.map
{
"name": "@kaguya-anime/parsers",
"version": "1.12.1",
"version": "1.13.0",
"main": "build/index.js",

@@ -43,3 +43,3 @@ "license": "MIT",

},
"gitHead": "c7569a4f31c5f5637d7e173ce30d10b16f58185b"
"gitHead": "4c36edcd73268f0e0493f6f3c1893818e860b455"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc