Skip to content

Commit

Permalink
fix: circular and priority queue types 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
ChoGathK committed Sep 27, 2022
1 parent 05a69d4 commit 2ee3f1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/common/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ export interface ConvertOptions {
transformer?: Function;
}

export class PriorityElement<T = any> {
export interface PriorityElement<T = any> {
/**
* Priority Indicates the weight of the queue.
*/
public weight: number;
weight: number;
/**
* The actual content.
*/
public value: T;
value: T;
}

export interface CircularHandler {
close(): void;
}
4 changes: 3 additions & 1 deletion src/method/circular.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CircularHandler } from '../common';

/**
* Create a recurring scheduled task.
*
Expand All @@ -7,7 +9,7 @@
*
* @publicApi
*/
export function circular(callback: Function, interval: number, ...args: any[]) {
export function circular(callback: Function, interval: number, ...args: any[]): CircularHandler {
let timer: NodeJS.Timeout = null;

const close = () => {
Expand Down

0 comments on commit 2ee3f1e

Please sign in to comment.