Package Exports
- timer-function-execution
- timer-function-execution/src/index.ts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (timer-function-execution) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Timer Function Execution
Timer Function Execution is a library that provides a simple way to measure the execution time of functions in JavaScript and React Native. It supports both synchronous and asynchronous functions, making it a versatile tool for developers who want to optimize their code's performance.
Installation
You can install the library using npm or yarn:
$ npm install timer-function-execution
or
$ yarn add timer-function-execution
Usage
import Timer from "timer-function-execution";
const timer = new Timer();
// Measure the execution time of a synchronous function
timer.start();
simulateSyncOperation();
timer.stop();
console.log(
`Elapsed time for synchronous function: ${timer.getElapsedTime()} ms`
);
// Measure the execution time of an asynchronous function
await timer.measureAsync(async () => {
// Replace this with your asynchronous function
await simulateAsyncOperation();
});
Features
- Measure execution time of both synchronous and asynchronous functions.
- Support for asynchronous measurements using async/await.
- Simple and easy-to-use API.
License
This library is open-source and available under the MIT License.
Author
Created by gusbdev