diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-05-23 19:28:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-23 19:28:29 +0300 |
commit | 2952fb5405eabbb9e603e90fe2e972e9bddfcadd (patch) | |
tree | bcf78f5884e7ca0a8ce789f035782e4536617332 /js | |
parent | 1386b6ead586da15d0285941f2d980acc1d75eee (diff) |
Rename --allow-high-precision to --allow-hrtime (#2398)
Diffstat (limited to 'js')
-rw-r--r-- | js/performance.ts | 6 | ||||
-rw-r--r-- | js/performance_test.ts | 2 | ||||
-rw-r--r-- | js/permissions.ts | 4 | ||||
-rw-r--r-- | js/permissions_test.ts | 2 | ||||
-rw-r--r-- | js/test_util.ts | 20 |
5 files changed, 17 insertions, 17 deletions
diff --git a/js/performance.ts b/js/performance.ts index 51e213f0f..602c8018f 100644 --- a/js/performance.ts +++ b/js/performance.ts @@ -5,9 +5,9 @@ import * as flatbuffers from "./flatbuffers"; import { assert } from "./util"; export class Performance { - /** Returns a current time from Deno's start. - * In milliseconds. Flag --allow-high-precision give - * a precise measure. + /** Returns a current time from Deno's start in milliseconds. + * + * Use the flag --allow-hrtime return a precise value. * * const t = performance.now(); * console.log(`${t} ms since start!`); diff --git a/js/performance_test.ts b/js/performance_test.ts index 1238a3836..ac682364e 100644 --- a/js/performance_test.ts +++ b/js/performance_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { testPerm, assert } from "./test_util.ts"; -testPerm({ highPrecision: false }, function now(): void { +testPerm({ hrtime: false }, function now(): void { const start = performance.now(); setTimeout((): void => { const end = performance.now(); diff --git a/js/permissions.ts b/js/permissions.ts index d0885ba6a..13bcf7f90 100644 --- a/js/permissions.ts +++ b/js/permissions.ts @@ -11,7 +11,7 @@ export interface Permissions { net: boolean; env: boolean; run: boolean; - highPrecision: boolean; + hrtime: boolean; // NOTE: Keep in sync with src/permissions.rs } @@ -30,7 +30,7 @@ function createPermissions(inner: msg.PermissionsRes): Permissions { net: inner.net(), env: inner.env(), run: inner.run(), - highPrecision: inner.highPrecision() + hrtime: inner.hrtime() }; } diff --git a/js/permissions_test.ts b/js/permissions_test.ts index 0a16255e4..932ec2480 100644 --- a/js/permissions_test.ts +++ b/js/permissions_test.ts @@ -7,7 +7,7 @@ const knownPermissions: Deno.Permission[] = [ "write", "net", "env", - "highPrecision" + "hrtime" ]; for (let grant of knownPermissions) { diff --git a/js/test_util.ts b/js/test_util.ts index af5dbd2b5..1b9e2f48c 100644 --- a/js/test_util.ts +++ b/js/test_util.ts @@ -25,7 +25,7 @@ interface TestPermissions { net?: boolean; env?: boolean; run?: boolean; - highPrecision?: boolean; + hrtime?: boolean; } const processPerms = Deno.permissions(); @@ -51,7 +51,7 @@ function permToString(perms: Deno.Permissions): string { const n = perms.net ? 1 : 0; const e = perms.env ? 1 : 0; const u = perms.run ? 1 : 0; - const h = perms.highPrecision ? 1 : 0; + const h = perms.hrtime ? 1 : 0; return `permR${r}W${w}N${n}E${e}U${u}H${h}`; } @@ -69,7 +69,7 @@ function normalizeTestPermissions(perms: TestPermissions): Deno.Permissions { net: !!perms.net, run: !!perms.run, env: !!perms.env, - highPrecision: !!perms.highPrecision + hrtime: !!perms.hrtime }; } @@ -96,7 +96,7 @@ export function test(fn: testing.TestFunction): void { net: false, env: false, run: false, - highPrecision: false + hrtime: false }, fn ); @@ -152,7 +152,7 @@ test(function permissionsMatches(): void { net: false, env: false, run: false, - highPrecision: false + hrtime: false }, normalizeTestPermissions({ read: true }) ) @@ -166,7 +166,7 @@ test(function permissionsMatches(): void { net: false, env: false, run: false, - highPrecision: false + hrtime: false }, normalizeTestPermissions({}) ) @@ -180,7 +180,7 @@ test(function permissionsMatches(): void { net: true, env: true, run: true, - highPrecision: true + hrtime: true }, normalizeTestPermissions({ read: true }) ), @@ -195,7 +195,7 @@ test(function permissionsMatches(): void { net: true, env: false, run: false, - highPrecision: false + hrtime: false }, normalizeTestPermissions({ read: true }) ), @@ -210,7 +210,7 @@ test(function permissionsMatches(): void { net: true, env: true, run: true, - highPrecision: true + hrtime: true }, { read: true, @@ -218,7 +218,7 @@ test(function permissionsMatches(): void { net: true, env: true, run: true, - highPrecision: true + hrtime: true } ) ); |