Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
timer-creator
Advanced tools
Readme
A simple library to manage timeouts and intervals.
First you need to import it in your project
The require way
let { createInterval, destroyInterval, TimeUnit } = require("timer-creator");
The import way
import { createTimeout, destroyTimeout, TimeUnit } from "timer-creator";
Then use it to establish a periodic callback execution until condition
import { createInterval, destroyInterval, TimeUnit } from "timer-creator";
const TIMER_NAME = 'myIntervalName'
function myFunction() {
// YOUR OWN CODE AND STUFF
hasConditionMeeted && destroyInterval(TIMER_NAME)
}
createInterval(TIMER_NAME, myFunction, 2 * TimeUnit.MINUTE)
Or one time callback execution
import { createTimeout, TimeUnit } from "timer-creator";
function myFunction(arg1, arg2) {
// YOUR OWN CODE AND STUFF
}
createTimeout('myTimeoutName', myFunction, 30 * TimeUnit.SECOND, [arg1, arg2])
Contains time unit constants
Type: object
Time unit referent to Milisecond
Type: number
Time unit referent to Second in miliseconds
Type: number
Time unit referent to Minute in miliseconds
Type: number
Time unit referent to Hour in miliseconds
Type: number
Time unit referent to Day in miliseconds
Type: number
Checks whether exist interval with given name.
name
string interval nameReturns boolean true or false wheter interval is stored or not
Retrieves interval value for given name.
name
string interval nameReturns number interval number reference
Creates and _store interval object with given name, to execute callback function on the waitTime specified with given args.
name
string interval namecallback
Function the function to be executed as a callbackwaitTime
number the waiting time for the intervalargs
(string | Array | null) arguments to be passed to the callback functionDestroy interval with given name and removes it from _store.
name
string interval nameChecks whether exist timeout with given name.
name
string timeout nameReturns boolean true or false wheter timeout is stored or not
Retrieves timeout value for given name.
name
string timeout nameReturns number timeout number reference
Creates and store timeout object with given name, to execute callback function on the waitTime specified with given args, its removed from store when callback is executed.
name
string timeout namecallback
Function the function to be executed as a callbackwaitTime
number the waiting time for the timeoutargs
(string | Array | null) arguments to be passed to the callback functionDestroy timeout with given name and removes it from store.
name
string timeout nameContains time unit constants
Type: Object
Time unit referent to Milisecond
Type: number
Time unit referent to Second in miliseconds
Type: number
Time unit referent to Minute in miliseconds
Type: number
Time unit referent to Hour in miliseconds
Type: number
Time unit referent to Day in miliseconds
Type: number
Checks whether exist interval with given name.
name
string interval nameReturns boolean true or false wheter interval is stored or not
Retrieves interval value for given name.
name
string interval nameReturns number interval number reference
Creates and _store interval object with given name, to execute callback function on the waitTime specified with given args.
name
string interval namecallback
Function the function to be executed as a callbackwaitTime
number the waiting time for the intervalargs
(string | Array | null) arguments to be passed to the callback functionDestroy interval with given name and removes it from _store.
name
string interval nameChecks whether exist timeout with given name.
name
string timeout nameReturns boolean true or false wheter timeout is stored or not
Retrieves timeout value for given name.
name
string timeout nameReturns number timeout number reference
Creates and store timeout object with given name, to execute callback function on the waitTime specified with given args, its removed from store when callback is executed.
name
string timeout namecallback
Function the function to be executed as a callbackwaitTime
number the waiting time for the timeoutargs
(string | Array | null) arguments to be passed to the callback functionDestroy timeout with given name and removes it from store.
name
string timeout nameFAQs
A library to easy manage intervals and timeouts
The npm package timer-creator receives a total of 2 weekly downloads. As such, timer-creator popularity was classified as not popular.
We found that timer-creator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.