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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?