-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from vodyani/beta_8.x
Beta 8.x
- Loading branch information
Showing
27 changed files
with
430 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export interface ConvertOptions { | ||
/** | ||
* When the received value does not correspond to expectations, this value is returned. | ||
* | ||
* @default null | ||
*/ | ||
default?: any; | ||
/** | ||
* The conversion is carried out if the outcome of the conditional validation function execution is true. | ||
* | ||
* @empale (num: number) => num > 0 | ||
*/ | ||
condition?: (...args: any[]) => boolean; | ||
/** | ||
* The process that carries out the transition. | ||
* | ||
* @empale (data: any) => Number(data) | ||
*/ | ||
transformer?: Function; | ||
} | ||
|
||
export class PriorityElement<T = any> { | ||
/** | ||
* Priority Indicates the weight of the queue. | ||
*/ | ||
public weight: number; | ||
/** | ||
* The actual content. | ||
*/ | ||
public value: T; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Create a recurring scheduled task. | ||
* | ||
* @param callback A callback function that needs to be called periodically. | ||
* @param interval number The cycle time, default 1000 (The time unit is milliseconds). | ||
* @param args any[] The callback argument. | ||
* | ||
* @publicApi | ||
*/ | ||
export function circular(callback: Function, interval: number, ...args: any[]) { | ||
let timer: NodeJS.Timeout = null; | ||
|
||
const close = () => { | ||
if (timer) clearTimeout(timer); | ||
}; | ||
|
||
const regularly = () => { | ||
close(); | ||
timer = setTimeout(regularlyHandler, interval); | ||
}; | ||
|
||
const regularlyHandler = () => { | ||
callback(...args); | ||
regularly(); | ||
}; | ||
|
||
regularly(); | ||
|
||
return { close }; | ||
} |
Oops, something went wrong.