tickedoff

小小的库(<200B gzip),用于将某些东西推迟到一个 "tick"。「Tiny library (<200B gzip) for deferring something by a "tick"」

Github星跟踪图

tickedoff

Tiny library (<200B gzip) for deferring something by a "tick"

  • Using setTimeout is actually a bit slow because its clamped to 4ms
  • setImmediate is not available in most places (and probably never will be)
  • process.nextTick is only in Node
  • Promise#then needs polyfills in places
  • tickedoff uses whatever the best available option is
  • There are more robust libraries/polyfills but they are larger in size
  • This is all especially good for libraries to use

Install

yarn add tickedoff

Usage

const defer = require('tickedoff');

console.log(1);
defer(() => console.log(3));
console.log(2);
// 1
// 2
// 3

Perf

$ node perf.js
process.nextTick x 10000 = 24ms
Promise#then x 10000 = 29ms
setImmediate x 10000 = 68ms
setTimeout x 10000 = 13506ms

主要指标

概览
名称与所有者jamiebuilds/tickedoff
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台Linux, Mac, Web browsers, Windows
许可证MIT License
所有者活动
创建于2018-03-26 17:53:50
推送于2023-06-13 09:55:04
最后一次提交2018-04-20 12:31:48
发布数3
最新版本名称v1.0.2 (发布于 2018-04-20 12:31:48)
第一版名称v1.0.0 (发布于 2018-03-26 10:54:03)
用户参与
星数218
关注者数5
派生数15
提交数7
已启用问题?
问题数0
打开的问题数0
拉请求数1
打开的拉请求数2
关闭的拉请求数2
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?