This commit is contained in:
eric sciple 2020-01-24 12:20:47 -05:00
parent a004f0ae58
commit fc725ba36b
7280 changed files with 19 additions and 1796407 deletions

View file

@ -1,9 +0,0 @@
Copyright 2014 kumavis
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,25 +0,0 @@
# 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.

View file

@ -1,28 +0,0 @@
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]
}

View file

@ -1,50 +0,0 @@
{
"_args": [
[
"browser-process-hrtime@0.1.3",
"/Users/eric/repos/actions/setup-node"
]
],
"_development": true,
"_from": "browser-process-hrtime@0.1.3",
"_id": "browser-process-hrtime@0.1.3",
"_inBundle": false,
"_integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==",
"_location": "/browser-process-hrtime",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "browser-process-hrtime@0.1.3",
"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": "/Users/eric/repos/actions/setup-node",
"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"
}