包详细信息

nanodelay

ai5.6kMIT2.0.2

A tiny (25 bytes) Promise wrapper around setTimeout

promise, delay, settimeout, setTimeout

自述文件

Nano Delay

A tiny Promise wrapper around setTimeout for JavaScript. Returns a Promise and resolve it after a specific amount of time.

  • Only 40 bytes (minified and gzipped), 10 times smaller than delay library.
  • Has good ES modules and TypeScript support.
import { delay } from 'nanodelay'

async function foo () {
  await delay(300)
  // Executed after 300 milliseconds
}

delay(300).then(() => {
  // Executed after 300 milliseconds
})

Sponsored by Evil Martians

Docs

Read full docs on GitHub.

更新日志

Change Log

This project adheres to Semantic Versioning.

2.0.2

  • Reduced package size.

2.0.1

  • Fixed package.json export.

2.0

  • Moved project to ESM-only type. Applications must use ESM too.
  • Dropped Node.js 10 support.

1.0.8

  • Added default to package.exports.

1.0.7

  • Removed ChangeLog from package.

1.0.6

  • Fixed package.types path.

1.0.5

  • Added package.types.

1.0.4

  • Fixed TypeScript definitions.

1.0.3

  • Fix ES modules support.

1.0.2

  • Fix name conflict in TypeScript definitions.

1.0.1

  • Mark package to be free from side effects.

1.0

  • Add ES modules support.
  • Use ES2016 syntax.
  • Reduce size.

0.1.4

  • Fix JSDoc.

0.1.3

  • Add TypeScript definitions (by Danakt Frost).

0.1.2

  • Reduce size (by Federico Brigante).

0.1.1

  • Clean dependencies.

0.1

  • Initial release.