# gytimer

> Correction of the work of the usual function 'setTimeout' and the addition of new functionality

Latest version **2.0.0** (published 2022-03-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install gytimer
pnpm add gytimer
yarn add gytimer
bun add gytimer
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-03-22 |
| First published | 2021-03-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | sha512boo |
| Maintainers | sha512boo |
| Keywords | settimeout, js, fixed, gytimer |

## Links

- npm: https://www.npmjs.com/package/gytimer
- Repository: https://github.com/sha512boo/gytimer
- Issues: https://github.com/sha512boo/gytimer/issues
- npm.io page: https://npm.io/package/gytimer

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2022-03-22
- 1.2.9 — 2022-03-22
- 1.2.8 — 2022-02-14
- 1.1.8 — 2021-07-02
- 1.1.7 — 2021-07-02
- 1.1.6 — 2021-04-02
- 1.1.5 — 2021-03-21
- 1.0.5 — 2021-03-20
- 1.0.4 — 2021-03-20
- 1.0.2 — 2021-03-19
- 1.0.1 — 2021-03-19

## README

<snippet>
<content><![CDATA[
# ${1:gytimer}

What does that package? 
- Fixes issues with the event loop's native setTimeout function. 
- Adds a new asynchronous function "sleep". 
- Does not clog event loop, but speeds it up

## Installation

$ npm install gytimer

## Usage 

For more detailed information on how to use this module, I recommend using:
npm run test

```javascript
import { setCustomTimeout, clearCustomTimeout, sleep } from 'gytimer'

/**
 * Get the current Unix time
 */
const timestamp = Date.now()


/**
 * Clear timeout example
 * Outputs: nothing
 */
const purifiedCustomTimeout = setCustomTimeout(() =>  {
    console.log('This timeout will purify 😰')
}, 1000)

clearCustomTimeout(purifiedCustomTimeout)

/**
 * Execution timeout example
 * Outputs: This timeout will execute successful for 1041 ms 😇
 */
setCustomTimeout (() => {
    console.log(`This timeout will execute successful for ${Date.now() - timestamp} ms 😇`) 
}, 1000) 

/**
 * Sleep function example
 * @param {number} duration 
 */
async function testSleep (duration) {
    let sleepStart = Date.now() 
    for (let key in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) {
        await sleep(duration)
        console.log(key)
    }
    console.log(`Log after sleep has sent (${Date.now() - sleepStart}) 😇`) 
}

testSleep(2000)
```

## Credits
sha512boo
## License
ISC
</content>
</snippet>

---
_Source: https://npm.io/package/gytimer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
