initial
This commit is contained in:
1
node_modules/performance-now/.npmignore
generated
vendored
Normal file
1
node_modules/performance-now/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.DS_Store
|
||||
7
node_modules/performance-now/.tm_properties
generated
vendored
Normal file
7
node_modules/performance-now/.tm_properties
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
excludeDirectories = "{.git,node_modules}"
|
||||
excludeInFolderSearch = "{excludeDirectories,lib}"
|
||||
|
||||
includeFiles = "{.gitignore,.npmignore,.travis.yml}"
|
||||
|
||||
[ attr.untitled ]
|
||||
fileType = 'source.coffee'
|
||||
4
node_modules/performance-now/.travis.yml
generated
vendored
Normal file
4
node_modules/performance-now/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
25
node_modules/performance-now/Makefile
generated
vendored
Normal file
25
node_modules/performance-now/Makefile
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
build:
|
||||
mkdir -p lib
|
||||
rm -rf lib/*
|
||||
node_modules/.bin/coffee --compile --output lib/ src/
|
||||
|
||||
watch:
|
||||
node_modules/.bin/coffee --watch --compile --output lib/ src/
|
||||
|
||||
test:
|
||||
node_modules/.bin/mocha
|
||||
|
||||
jumpstart:
|
||||
curl -u 'meryn' https://api.github.com/user/repos -d '{"name":"performance-now", "description":"Implements performance.now (based on process.hrtime).","private":false}'
|
||||
mkdir -p src
|
||||
touch src/performance-now.coffee
|
||||
mkdir -p test
|
||||
touch test/performance-now.coffee
|
||||
npm install
|
||||
git init
|
||||
git remote add origin git@github.com:meryn/performance-now
|
||||
git add .
|
||||
git commit -m "jumpstart commit."
|
||||
git push -u origin master
|
||||
|
||||
.PHONY: test
|
||||
30
node_modules/performance-now/README.md
generated
vendored
Normal file
30
node_modules/performance-now/README.md
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# performance-now [](https://travis-ci.org/meryn/performance-now) [](https://david-dm.org/meryn/performance-now)
|
||||
|
||||
Implements a function similar to `performance.now` (based on `process.hrtime`).
|
||||
|
||||
Modern browsers have a `window.performance` object with - among others - a `now` method which gives time in miliseconds, but with sub-milisecond precision. This module offers the same function based on the Node.js native `process.hrtime` function.
|
||||
|
||||
According to the [High Resolution Time specification](http://www.w3.org/TR/hr-time/), the number of miliseconds reported by `performance.now` should be relative to the value of `performance.timing.navigationStart`. For this module, it's relative to when the time when this module got loaded. Right after requiring this module for the first time, the reported time is expected to have a near-zero value.
|
||||
|
||||
Using `process.hrtime` means that the reported time will be monotonically increasing, and not subject to clock-drift.
|
||||
|
||||
## Example usage
|
||||
|
||||
```javascript
|
||||
var now = require("performance-now")
|
||||
var start = now()
|
||||
var end = now()
|
||||
console.log(start.toFixed(3)) // ~ 0.05 on my system
|
||||
console.log((start-end).toFixed(3)) // ~ 0.002 on my system
|
||||
```
|
||||
|
||||
Running the now function two times right after each other yields a time difference of a few microseconds. Given this overhead, I think it's best to assume that the precision of intervals computed with this method is not higher than 10 microseconds, if you don't know the exact overhead on your own system.
|
||||
|
||||
## Credits
|
||||
|
||||
The initial structure of this module was generated by [Jumpstart](https://github.com/meryn/jumpstart), using the [Jumpstart Black Coffee](https://github.com/meryn/jumpstart-black-coffee) template.
|
||||
|
||||
## License
|
||||
|
||||
performance-now is released under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
Copyright (c) 2013 Meryn Stol
|
||||
32
node_modules/performance-now/lib/performance-now.js
generated
vendored
Normal file
32
node_modules/performance-now/lib/performance-now.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Generated by CoffeeScript 1.7.1
|
||||
(function() {
|
||||
var getNanoSeconds, hrtime, loadTime;
|
||||
|
||||
if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
|
||||
module.exports = function() {
|
||||
return performance.now();
|
||||
};
|
||||
} else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
|
||||
module.exports = function() {
|
||||
return (getNanoSeconds() - loadTime) / 1e6;
|
||||
};
|
||||
hrtime = process.hrtime;
|
||||
getNanoSeconds = function() {
|
||||
var hr;
|
||||
hr = hrtime();
|
||||
return hr[0] * 1e9 + hr[1];
|
||||
};
|
||||
loadTime = getNanoSeconds();
|
||||
} else if (Date.now) {
|
||||
module.exports = function() {
|
||||
return Date.now() - loadTime;
|
||||
};
|
||||
loadTime = Date.now();
|
||||
} else {
|
||||
module.exports = function() {
|
||||
return new Date().getTime() - loadTime;
|
||||
};
|
||||
loadTime = new Date().getTime();
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
7
node_modules/performance-now/license.txt
generated
vendored
Normal file
7
node_modules/performance-now/license.txt
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2013 Meryn Stol
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
57
node_modules/performance-now/package.json
generated
vendored
Normal file
57
node_modules/performance-now/package.json
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"_from": "performance-now@^0.2.0",
|
||||
"_id": "performance-now@0.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=",
|
||||
"_location": "/performance-now",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "performance-now@^0.2.0",
|
||||
"name": "performance-now",
|
||||
"escapedName": "performance-now",
|
||||
"rawSpec": "^0.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz",
|
||||
"_shasum": "33ef30c5c77d4ea21c5a53869d91b56d8f2555e5",
|
||||
"_spec": "performance-now@^0.2.0",
|
||||
"_where": "C:\\Users\\Tom\\Documents\\Development\\bitsy-image-to-room\\node_modules\\request",
|
||||
"author": {
|
||||
"name": "Meryn Stol",
|
||||
"email": "merynstol@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/meryn/performance-now/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Implements performance.now (based on process.hrtime).",
|
||||
"devDependencies": {
|
||||
"coffee-script": "~1.7.1",
|
||||
"mocha": "~1.21.0"
|
||||
},
|
||||
"homepage": "https://github.com/meryn/performance-now",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"main": "lib/performance-now.js",
|
||||
"name": "performance-now",
|
||||
"optionalDependencies": {},
|
||||
"private": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/meryn/performance-now.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "npm test",
|
||||
"pretest": "make build",
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "0.2.0"
|
||||
}
|
||||
15
node_modules/performance-now/src/performance-now.coffee
generated
vendored
Normal file
15
node_modules/performance-now/src/performance-now.coffee
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
if performance? and performance.now
|
||||
module.exports = -> performance.now()
|
||||
else if process? and process.hrtime
|
||||
module.exports = -> (getNanoSeconds() - loadTime) / 1e6
|
||||
hrtime = process.hrtime
|
||||
getNanoSeconds = ->
|
||||
hr = hrtime()
|
||||
hr[0] * 1e9 + hr[1]
|
||||
loadTime = getNanoSeconds()
|
||||
else if Date.now
|
||||
module.exports = -> Date.now() - loadTime
|
||||
loadTime = Date.now()
|
||||
else
|
||||
module.exports = -> new Date().getTime() - loadTime
|
||||
loadTime = new Date().getTime()
|
||||
3
node_modules/performance-now/test/mocha.opts
generated
vendored
Normal file
3
node_modules/performance-now/test/mocha.opts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
--require coffee-script/register
|
||||
--compilers coffee:coffee-script/register
|
||||
--reporter spec
|
||||
38
node_modules/performance-now/test/performance-now.coffee
generated
vendored
Normal file
38
node_modules/performance-now/test/performance-now.coffee
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
assert = require "assert"
|
||||
|
||||
delay = (ms, fn) -> setTimeout fn, ms
|
||||
now = undefined
|
||||
describe "now", ->
|
||||
it "initially gives a near zero (< 20 ms) time ", ->
|
||||
now = require "../"
|
||||
assert now() < 20
|
||||
|
||||
it "gives a positive time", ->
|
||||
assert now() > 0
|
||||
|
||||
it "two subsequent calls return an increasing number", ->
|
||||
a = now()
|
||||
b = now()
|
||||
assert now() < now()
|
||||
|
||||
it "has less than 10 microseconds overhead", ->
|
||||
Math.abs(now() - now()) < 0.010
|
||||
|
||||
it "can do 1,000,000 calls really quickly", ->
|
||||
now() for i in [0...1000000]
|
||||
|
||||
it "shows that at least 990 ms has passed after a timeout of 1 second", (done) ->
|
||||
a = now()
|
||||
delay 1000, ->
|
||||
b = now()
|
||||
diff = b - a
|
||||
return done new Error "Diff (#{diff}) lower than 990." if diff < 990
|
||||
return done null
|
||||
|
||||
it "shows that not more than 1020 ms has passed after a timeout of 1 second", (done) ->
|
||||
a = now()
|
||||
delay 1000, ->
|
||||
b = now()
|
||||
diff = b - a
|
||||
return done new Error "Diff (#{diff}) higher than 1020." if diff > 1020
|
||||
return done null
|
||||
Reference in New Issue
Block a user