@dxos/util
Advanced tools
Comparing version 2.5.2-alpha.0 to 2.5.2-beta.0
@@ -9,3 +9,19 @@ /** | ||
export declare function warnAfterTimeout<T>(timeout: number, context: string, body: () => Promise<T>): Promise<T>; | ||
/** | ||
* A decorator that prints a warning to console if method execution time exceeds specified timeout. | ||
* | ||
* ```typescript | ||
* class Foo { | ||
* @timed(5000) | ||
* async doStuff() { | ||
* // long task | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* This is useful for debugging code that might deadlock. | ||
* | ||
* @param timeout Timeout in milliseconds after which the warning is printed. | ||
*/ | ||
export declare function timed(timeout: number): (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<(...args: any) => any>) => void; | ||
//# sourceMappingURL=timeout-warning.d.ts.map |
@@ -27,2 +27,18 @@ "use strict"; | ||
exports.warnAfterTimeout = warnAfterTimeout; | ||
/** | ||
* A decorator that prints a warning to console if method execution time exceeds specified timeout. | ||
* | ||
* ```typescript | ||
* class Foo { | ||
* @timed(5000) | ||
* async doStuff() { | ||
* // long task | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* This is useful for debugging code that might deadlock. | ||
* | ||
* @param timeout Timeout in milliseconds after which the warning is printed. | ||
*/ | ||
function timed(timeout) { | ||
@@ -29,0 +45,0 @@ return (target, propertyName, descriptor) => { |
{ | ||
"name": "@dxos/util", | ||
"version": "2.5.2-alpha.0", | ||
"version": "2.5.2-beta.0", | ||
"description": "Utilities to be moved to other repos.", | ||
@@ -20,3 +20,3 @@ "homepage": "https://github.com/dxos/echo/tree/master/packages/echo#readme", | ||
"depcheck": "npx depcheck --specials=bin,babel,eslint,lint-staged,jest", | ||
"coverage": "jest --coverage --verbose src", | ||
"coverage": "jest --coverage --verbose --rootDir=./src", | ||
"lint": "eslint './src/**/*.ts'", | ||
@@ -67,3 +67,3 @@ "test": "jest --rootDir=./src --verbose --passWithNoTests", | ||
}, | ||
"gitHead": "0b12ed4c090d34a5454e0d637503b20ad486d592" | ||
"gitHead": "e9498f19374c7dce5570abb4a55780477b93bc9c" | ||
} |
@@ -24,2 +24,18 @@ // | ||
/** | ||
* A decorator that prints a warning to console if method execution time exceeds specified timeout. | ||
* | ||
* ```typescript | ||
* class Foo { | ||
* @timed(5000) | ||
* async doStuff() { | ||
* // long task | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* This is useful for debugging code that might deadlock. | ||
* | ||
* @param timeout Timeout in milliseconds after which the warning is printed. | ||
*/ | ||
export function timed (timeout: number) { | ||
@@ -26,0 +42,0 @@ return ( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
272891
1468