# idle-until-urgent **Repository Path**: mirrors_developit/idle-until-urgent ## Basic Information - **Project Name**: idle-until-urgent - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # idle-until-urgent Fetch resources lazily - either whenever the browser is next idle, or when you request the resource. In a browser that doesn't have [requestIdleTimeout](https://caniuse.com/#feat=requestidlecallback), or in node.js, falls back to `setTimeout(fn, 1000)`. Inspired directly by [this 💯 post by Philip Walton](https://philipwalton.com/articles/idle-until-urgent/), but uses a function-based API instead of classes. It's also about a third the size of [`idlize/defineIdleProperty.mjs`](https://github.com/GoogleChromeLabs/idlize/blob/master/defineIdleProperty.mjs) (after minification) by avoiding classes and using the dumbest possible `requestIdleTimeout` fallback. ## Install ```sh npm i idle-until-urgent ``` ``` const makeIdleGetter = require('idle-until-urgent') ``` ## Usage ```js const getFormatter = makeIdleGetter(() => new Intl.DateTimeFormat('en-US', { timeZone: 'America/Los_Angeles', })) // later in your code, presumably not during the first tick... getFormatter().format(new Date(1537452915210)) // => '9/20/2018' ``` ## License [WTFPL](http://wtfpl2.com)