95 lines
11 KiB
JSON
95 lines
11 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "w3c-hr-time@^1.0.1",
|
||
|
"scope": null,
|
||
|
"escapedName": "w3c-hr-time",
|
||
|
"name": "w3c-hr-time",
|
||
|
"rawSpec": "^1.0.1",
|
||
|
"spec": ">=1.0.1 <2.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom"
|
||
|
]
|
||
|
],
|
||
|
"_from": "w3c-hr-time@>=1.0.1 <2.0.0",
|
||
|
"_id": "w3c-hr-time@1.0.1",
|
||
|
"_inCache": true,
|
||
|
"_location": "/w3c-hr-time",
|
||
|
"_npmOperationalInternal": {
|
||
|
"host": "s3://npm-registry-packages",
|
||
|
"tmp": "tmp/w3c-hr-time-1.0.1.tgz_1514946814012_0.002114632399752736"
|
||
|
},
|
||
|
"_npmUser": {
|
||
|
"name": "timothygu",
|
||
|
"email": "timothygu99@gmail.com"
|
||
|
},
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "w3c-hr-time@^1.0.1",
|
||
|
"scope": null,
|
||
|
"escapedName": "w3c-hr-time",
|
||
|
"name": "w3c-hr-time",
|
||
|
"rawSpec": "^1.0.1",
|
||
|
"spec": ">=1.0.1 <2.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/jsdom"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz",
|
||
|
"_shasum": "82ac2bff63d950ea9e3189a58a65625fedf19045",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "w3c-hr-time@^1.0.1",
|
||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom",
|
||
|
"author": {
|
||
|
"name": "Timothy Gu",
|
||
|
"email": "timothygu99@gmail.com"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/jsdom/w3c-hr-time/issues"
|
||
|
},
|
||
|
"dependencies": {
|
||
|
"browser-process-hrtime": "^0.1.2"
|
||
|
},
|
||
|
"description": "An implementation of the W3C High Resolution Time Level 2 specification.",
|
||
|
"devDependencies": {
|
||
|
"eslint": "^4.14.0",
|
||
|
"eslint-plugin-jest": "^21.5.0",
|
||
|
"jest": "^22.0.4"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"shasum": "82ac2bff63d950ea9e3189a58a65625fedf19045",
|
||
|
"tarball": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz"
|
||
|
},
|
||
|
"files": [
|
||
|
"lib",
|
||
|
"index.js"
|
||
|
],
|
||
|
"homepage": "https://github.com/jsdom/w3c-hr-time#readme",
|
||
|
"license": "MIT",
|
||
|
"main": "index.js",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "timothygu",
|
||
|
"email": "timothygu99@gmail.com"
|
||
|
}
|
||
|
],
|
||
|
"name": "w3c-hr-time",
|
||
|
"optionalDependencies": {},
|
||
|
"private": false,
|
||
|
"readme": "# w3c-hr-time\n\nThis module implements the W3C [High Resolution Time Level 2][HR-TIME] specification. It provides exactly three exports:\n\n- `Performance` class\n- `getGlobalMonotonicClockMS(): number`\n- `clockIsAccurate: boolean`\n\nIn all APIs, a \"high-resolution timestamp\" means a number in milliseconds that may have a fractional part, if the system clock is accurate enough (see \"Clock accuracy\" section below). It is identical to the [`DOMHighResTimeStamp`][] type in the High Resolution Time spec.\n\nPortability is paramount to this module. It uses only APIs exposed from Node.js core like `Date.now()` and `process.hrtime()` and does not use or require any native modules. It also employs the [browser-process-hrtime][] module for graceful degrades for platforms that do not have `process.hrtime()` (such as browsers).\n\n## `Performance` class\n\n```js\nconst { Performance } = require(\"w3c-hr-time\");\nconst performance = new Performance();\n\nconsole.log(performance.timeOrigin);\n// Prints a number close to Date.now() but that may have fractional parts, like\n// 1514888563819.351.\n\nconsole.log(new Date(performance.timeOrigin));\n// Prints a date close to new Date(), like 2018-01-02T10:22:43.819Z.\n\nsetTimeout(() => {\n console.log(performance.now());\n // Prints a number close to 5000, like 5008.023059.\n}, 5000);\n```\n\nPerhaps the most interesting export is the [`Performance`][] class. By constructing the class, you can get an instance quite similar to the `window.performance` object in browsers. Specifically, the following APIs are implemented:\n\n* [`performance.now(): number`][`Performance#now()`] returns the high-resolution duration since the construction of the `Performance` object.\n* [`performance.timeOrigin: number`][`Performance#timeOrigin`] is a high-resolution timestamp of the `Performance` object's construction, expressed in [Unix time][].\n* [`performance.toJSON(): object`][`Performance#toJSON()`] returns an object with `timeOrigin` property set to the corresponding value of this object. This allows serializing the `Performance` object with `JSON.stringify()`. In browsers, the returned object may contain additional properties such as `navigation` and `timing`. However, those properties are specific to browser navigation and are unsuitable for a Node.js implementation. Furthermore, they are specified not in the High Resolution Time spec but in [Navigation Timing][NAVIGATION-TIMING], and are thereby outside the scope of this module.\n\n### Limitations\n\nThis module does not aim for full [Web IDL][WEBIDL] conformance, so things like `performance.toJSON.call({})` will not throw `TypeError`s like it does in browsers. If you need full Web IDL conformance, you may be interested in the [webidl2js][] module.\n\nThe `Performance` class provided also does not have `mark()`, `measure()`, `getEntries()`, and such functions. They are specified in other specs than High Resolution Timing, such as [User Timing][USER-TIMING] (marks and measures) and [Performance Timeline][PERFORMANCE-TIMELINE] (entries management). Those specs extend the definition of the `Performance` class defined in High Resolution Timing, and to implement those specs you can extend the `Performance` class exported by this module.\n\nDue to the limitations of the APIs exposed through Node.js, the construction of a `Performance` object may take up to 1 millisecond to gather information for high-resolution `timeOrigin`.\n\n## Global monotonic clock\n\nThe High Resolution Time spec defines a [global monotonic clock][] that is \"shared by time origin's *[sic]*, is monotonically increasing and not subject to system clock adjustments or system clock skew, and whose reference point is the Unix time.\"\n\nThis module exports a function `getGlobalMonotonicClockMS()` that is the basis of all timing functions used my this module when a monotonic time is required. It returns a high-resolution timestamp whose zero value is at some arbitrary point in the past. (For the current high-resolution timestamp based on the Unix epoch, use `new Per
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git+https://github.com/jsdom/w3c-hr-time.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"lint": "eslint .",
|
||
|
"test": "jest"
|
||
|
},
|
||
|
"version": "1.0.1"
|
||
|
}
|