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

adonisjs-scheduler

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonisjs-scheduler - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

10

build/commands/SchedulerCommand.js

@@ -14,3 +14,11 @@ "use strict";

node_cron_1.default.schedule(command.expression, async () => {
await Ace.exec(command.commandName, command.commandArgs);
switch (command.type) {
case "command":
await Ace.exec(command.commandName, command.commandArgs);
break;
case "callback":
await command.callback();
default:
break;
}
});

@@ -17,0 +25,0 @@ }

21

build/src/scheduler.d.ts

@@ -1,6 +0,4 @@

declare class ScheduleCommand {
commandName: string;
commandArgs: string[];
declare abstract class BaseSchedule {
abstract type: string;
expression: string;
constructor(commandName: string, commandArgs?: string[]);
everyMinute(): this;

@@ -10,6 +8,19 @@ everyFiveSeconds(): this;

}
declare class ScheduleCommand extends BaseSchedule {
type: string;
commandName: string;
commandArgs: string[];
constructor(commandName: string, commandArgs?: string[]);
}
declare class ScheduleCallback extends BaseSchedule {
type: string;
callback: Function;
constructor(callback: Function);
}
export declare class Scheduler {
commands: ScheduleCommand[];
commands: BaseSchedule[];
command(name: string, args?: string[]): ScheduleCommand;
callback(callback: Function): ScheduleCallback;
closure(callback: Function): ScheduleCallback;
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Scheduler = void 0;
class ScheduleCommand {
constructor(commandName, commandArgs = []) {
Object.defineProperty(this, "commandName", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "commandArgs", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
class BaseSchedule {
constructor() {
Object.defineProperty(this, "expression", {

@@ -24,4 +12,2 @@ enumerable: true,

});
this.commandName = commandName;
this.commandArgs = commandArgs;
}

@@ -41,2 +27,45 @@ everyMinute() {

}
class ScheduleCommand extends BaseSchedule {
constructor(commandName, commandArgs = []) {
super();
Object.defineProperty(this, "type", {
enumerable: true,
configurable: true,
writable: true,
value: "command"
});
Object.defineProperty(this, "commandName", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "commandArgs", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.commandName = commandName;
this.commandArgs = commandArgs;
}
}
class ScheduleCallback extends BaseSchedule {
constructor(callback) {
super();
Object.defineProperty(this, "type", {
enumerable: true,
configurable: true,
writable: true,
value: "callback"
});
Object.defineProperty(this, "callback", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.callback = callback;
}
}
class Scheduler {

@@ -56,3 +85,11 @@ constructor() {

}
callback(callback) {
let newCommand = new ScheduleCallback(callback);
this.commands.push(newCommand);
return newCommand;
}
closure(callback) {
return this.callback(callback);
}
}
exports.Scheduler = Scheduler;
import Scheduler from "@ioc:Adonis/Addons/Scheduler"
Scheduler.command("inspire").everyFiveSeconds();
Scheduler.command("inspire").everyFiveSeconds();
Scheduler.callback(() => {
console.log("Hello !");
}).everyFiveSeconds();
{
"name": "adonisjs-scheduler",
"version": "0.0.6",
"version": "0.0.7",
"description": "",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/KABBOUCHI/adonisjs-scheduler#readme",

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