feat: complete MDX migration, stabilize routing and lead capture
Former-commit-id: ab5cc38c97e5f73d6e821465b90d199fb6e6edc9
This commit is contained in:
Generated
Vendored
-38
@@ -1,38 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
/* global SharedArrayBuffer, Atomics */
|
||||
|
||||
if (typeof SharedArrayBuffer !== 'undefined' && typeof Atomics !== 'undefined') {
|
||||
const nil = new Int32Array(new SharedArrayBuffer(4))
|
||||
|
||||
function sleep (ms) {
|
||||
// also filters out NaN, non-number types, including empty strings, but allows bigints
|
||||
const valid = ms > 0 && ms < Infinity
|
||||
if (valid === false) {
|
||||
if (typeof ms !== 'number' && typeof ms !== 'bigint') {
|
||||
throw TypeError('sleep: ms must be a number')
|
||||
}
|
||||
throw RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity')
|
||||
}
|
||||
|
||||
Atomics.wait(nil, 0, 0, Number(ms))
|
||||
}
|
||||
module.exports = sleep
|
||||
} else {
|
||||
|
||||
function sleep (ms) {
|
||||
// also filters out NaN, non-number types, including empty strings, but allows bigints
|
||||
const valid = ms > 0 && ms < Infinity
|
||||
if (valid === false) {
|
||||
if (typeof ms !== 'number' && typeof ms !== 'bigint') {
|
||||
throw TypeError('sleep: ms must be a number')
|
||||
}
|
||||
throw RangeError('sleep: ms must be a number that is greater than 0 but less than Infinity')
|
||||
}
|
||||
const target = Date.now() + Number(ms)
|
||||
while (target > Date.now()){}
|
||||
}
|
||||
|
||||
module.exports = sleep
|
||||
|
||||
}
|
||||
Generated
Vendored
-37
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "atomic-sleep",
|
||||
"version": "1.0.0",
|
||||
"description": "Zero CPU overhead, zero dependency, true event-loop blocking sleep",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap -R classic- -j1 test",
|
||||
"lint": "standard",
|
||||
"ci": "npm run lint && npm test"
|
||||
},
|
||||
"keywords": [
|
||||
"sleep",
|
||||
"pause",
|
||||
"wait",
|
||||
"performance",
|
||||
"atomics"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"author": "David Mark Clements (@davidmarkclem)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"standard": "^14.3.1",
|
||||
"tap": "^14.10.6",
|
||||
"tape": "^4.13.2"
|
||||
},
|
||||
"dependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/davidmarkclements/atomic-sleep.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/davidmarkclements/atomic-sleep/issues"
|
||||
},
|
||||
"homepage": "https://github.com/davidmarkclements/atomic-sleep#readme"
|
||||
}
|
||||
Reference in New Issue
Block a user