Initial pass

This commit is contained in:
Danny McCormick
2019-06-26 21:12:00 -04:00
commit 39c08a0eaa
7242 changed files with 1886006 additions and 0 deletions
+9
View File
File diff suppressed because one or more lines are too long
+25
View File
@@ -0,0 +1,25 @@
# browser-process-hrtime
Browser shim for Node.js process.hrtime().
See [documentation at nodejs.org](http://nodejs.org/api/process.html#process_process_hrtime)
### usage
Use hrtime independant of environment (node or browser).
It will use process.hrtime first and fallback if not present.
```js
var hrtime = require('browser-process-hrtime')
var start = hrtime()
// ...
var delta = hrtime(start)
```
### monkey-patching
You can monkey-patch process.hrtime for your dependency graph like this:
```js
process.hrtime = require('browser-process-hrtime')
var coolTool = require('module-that-uses-hrtime-somewhere-in-its-depths')
```
### note
This was originally pull-requested against [node-process](https://github.com/defunctzombie/node-process),
but they are trying to stay lean.
+28
View File
@@ -0,0 +1,28 @@
module.exports = process.hrtime || hrtime
// polyfil for window.performance.now
var performance = global.performance || {}
var performanceNow =
performance.now ||
performance.mozNow ||
performance.msNow ||
performance.oNow ||
performance.webkitNow ||
function(){ return (new Date()).getTime() }
// generate timestamp or delta
// see http://nodejs.org/api/process.html#process_process_hrtime
function hrtime(previousTimestamp){
var clocktime = performanceNow.call(performance)*1e-3
var seconds = Math.floor(clocktime)
var nanoseconds = Math.floor((clocktime%1)*1e9)
if (previousTimestamp) {
seconds = seconds - previousTimestamp[0]
nanoseconds = nanoseconds - previousTimestamp[1]
if (nanoseconds<0) {
seconds--
nanoseconds += 1e9
}
}
return [seconds,nanoseconds]
}
+50
View File
@@ -0,0 +1,50 @@
{
"_args": [
[
"[email protected]",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==",
"_location": "/browser-process-hrtime",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "browser-process-hrtime",
"escapedName": "browser-process-hrtime",
"rawSpec": "0.1.3",
"saveSpec": null,
"fetchSpec": "0.1.3"
},
"_requiredBy": [
"/w3c-hr-time"
],
"_resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz",
"_spec": "0.1.3",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "kumavis"
},
"bugs": {
"url": "https://github.com/kumavis/browser-process-hrtime/issues"
},
"description": "Shim for process.hrtime in the browser",
"homepage": "https://github.com/kumavis/browser-process-hrtime#readme",
"license": "BSD-2-Clause",
"main": "index.js",
"name": "browser-process-hrtime",
"repository": {
"type": "git",
"url": "git://github.com/kumavis/browser-process-hrtime.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.1.3"
}