HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
hiroki0525
idle-task
TypeScript2022–2022
hiroki0525 / idle-task

idle-task

Improve your website performance by executing JavaScript during a browser's idle periods.

2Distinct people
4Mentions
0Explicit recommenders
151GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Improve your website performance by executing JavaScript during a browser's idle periods.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by hour4 dated mentions

Observed mentions: 2022-11-24 15:08:19 UTC to 2022-11-25 07:48:29 UTC.

0122022-11-24 15:00:00 UTC to 2022-11-24 16:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsNov 24, 15:002022-11-24 16:00:00 UTC to 2022-11-24 17:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-24 17:00:00 UTC to 2022-11-24 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-24 18:00:00 UTC to 2022-11-24 19:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-24 19:00:00 UTC to 2022-11-24 20:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-24 20:00:00 UTC to 2022-11-24 21:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-24 21:00:00 UTC to 2022-11-24 22:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-24 22:00:00 UTC to 2022-11-24 23:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-24 23:00:00 UTC to 2022-11-25 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsNov 24, 23:002022-11-25 00:00:00 UTC to 2022-11-25 01:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-25 01:00:00 UTC to 2022-11-25 02:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-25 02:00:00 UTC to 2022-11-25 03:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-25 03:00:00 UTC to 2022-11-25 04:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-25 04:00:00 UTC to 2022-11-25 05:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-25 05:00:00 UTC to 2022-11-25 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-25 06:00:00 UTC to 2022-11-25 07:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-11-25 07:00:00 UTC to 2022-11-25 08:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsNov 25, 07:00

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Nov 24, 15:002022-11-24 15:00:00 UTC2022-11-24 16:00:00 UTC101
Nov 24, 16:002022-11-24 16:00:00 UTC2022-11-24 17:00:00 UTC000
Nov 24, 17:002022-11-24 17:00:00 UTC2022-11-24 18:00:00 UTC000
Nov 24, 18:002022-11-24 18:00:00 UTC2022-11-24 19:00:00 UTC000
Nov 24, 19:002022-11-24 19:00:00 UTC2022-11-24 20:00:00 UTC000
Nov 24, 20:002022-11-24 20:00:00 UTC2022-11-24 21:00:00 UTC000
Nov 24, 21:002022-11-24 21:00:00 UTC2022-11-24 22:00:00 UTC000
Nov 24, 22:002022-11-24 22:00:00 UTC2022-11-24 23:00:00 UTC000
Nov 24, 23:002022-11-24 23:00:00 UTC2022-11-25 00:00:00 UTC202
Nov 25, 00:002022-11-25 00:00:00 UTC2022-11-25 01:00:00 UTC000
Nov 25, 01:002022-11-25 01:00:00 UTC2022-11-25 02:00:00 UTC000
Nov 25, 02:002022-11-25 02:00:00 UTC2022-11-25 03:00:00 UTC000
Nov 25, 03:002022-11-25 03:00:00 UTC2022-11-25 04:00:00 UTC000
Nov 25, 04:002022-11-25 04:00:00 UTC2022-11-25 05:00:00 UTC000
Nov 25, 05:002022-11-25 05:00:00 UTC2022-11-25 06:00:00 UTC000
Nov 25, 06:002022-11-25 06:00:00 UTC2022-11-25 07:00:00 UTC000
Nov 25, 07:002022-11-25 07:00:00 UTC2022-11-25 08:00:00 UTC101

What Hacker News says

4 sources
The code: https://github.com/hiroki0525/idle-task/blob/main/src/index.... Some initial impressions (based on https://github.com/hiroki0525/idle-task/blob/7e88c8b97c926cf...): • The cancelIdleCallback fallback implementation will never be defined, so cancelAllIdleTasks will unexpectedly throw an exception in environments like Safari that depend on the polyfill. (Solution: delete lines 14–15.) • That the simple fallback implementation is a modifying polyfill is not nice, if not clearly stated. Typically better to define it as a local, e.g. `const rIC = typeof requestIdleCallback !== "undefined" ? requestIdleCallback : function …` and subsequently use rIC instead of requestIdleCallback. (Related, I’m not sure quite why you only install the polyfill if self is a thing, are you deliberately ensuring you can’t use this in Node?) • The default c
Read the rest
ode path is broken, process.env.NODE_ENV will fail in normal browser environments since process is undefined. (And no, no build process gets rid of this, fetch the distributed package and see that its index.js still contains it.) • Line 74, don’t return a value from a private function if none of the uses use that value; just drop the return keyword. • Lines 86–93, splitting logArgs out doesn’t make sense to me, it’s functionally harmless, but needless bloat. (I am perennially disappointed at the utterly primitive state of JavaScript bundlers/optimisers/minifiers: especially with TypeScript knowledge of the interfaces being touched, reordering and inlining is a trivial and obvious optimisation that only changes behaviour on bonkers code that deserves to get broken, but no tool will do it, though Closure Compiler’s advanced optimisations mode might be able to be coaxed into doing it—if it even supports spread syntax.) • The vibe I’m getting is that this works with a mixture of callbacks and promises, and ends up complicated because of it, parts of it feeling like the ’90s and parts like the mid-’10s. The modern approach would be to use abort signals, which… eh, they’re simpler in some cases, more complicated in others. But from this library’s perspective, you could replace the entire interface with just one promise-returning function, which I’d name schedule(task, options), with options including {signal: AbortSignal}. Cancellation would be handled a bit differently, but it’d be more flexible, because it’s left up to the caller how they hook cancellation up (want to be able to cancel a subset of all the tasks together? Easy, give them the same signal). And I think the code of this library would be simplified by going all in on such a pattern.
In Show HN: Speed up your site by running JavaScript when the browser is idle

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.