Skip to content

Releases: RyanMyrvold/Performance-Decorators

3.0.4

27 Nov 02:32

Choose a tag to compare

Full Changelog: 3.0.2...3.0.4

3.0.2

27 Nov 02:26

Choose a tag to compare

Full Changelog: 3.0.1...3.0.2

3.0.1

26 Nov 05:01

Choose a tag to compare

Full Changelog: 2.9.5...3.0.1

2.9.5

17 Oct 20:00

Choose a tag to compare

  • Added loadAsyncLocalStorage function to conditionally load AsyncLocalStorage in Node environment.
  • Integrated AsyncLocalStorage to store and retrieve request context during network requests.

Full Changelog: 2.9.4...2.9.5

2.9.4

17 Oct 17:57

Choose a tag to compare

Full Changelog: 2.9.3...2.9.4

2.9.3

17 Oct 15:36

Choose a tag to compare

Release Notes - October 17, 2024

Refactored LogNetworkRequests Decorator

  • Removed global fetch replacement to eliminate race conditions when running multiple async functions concurrently.
  • Introduced a scoped fetchWrapper to inject the wrapped fetch into the decorated method context, ensuring independent logging for each function.
  • Enhanced error handling to ensure fetch unavailability is managed gracefully, with appropriate warnings.

What's Changed

Full Changelog: 2.9.2...2.9.3

2.9.2

25 Sep 18:22

Choose a tag to compare

What's Changed

Full Changelog: 2.9.1...2.9.2

2.9.1

28 Aug 03:26

Choose a tag to compare

What's Changed

Full Changelog: 2.9.0...2.9.1

2.9.0

28 Aug 03:23

Choose a tag to compare

What's Changed

Full Changelog: 2.8.0...2.9.0

2.8.0

25 Aug 13:31

Choose a tag to compare

2.8.0

New Feature: LogReturnValue Decorator

Overview:

  • The LogReturnValue decorator has been added to the Performance Decorators toolkit. This decorator logs the return value of a method each time it is called, making it easier to verify that methods return the expected results and aiding in the debugging process.

Key Features:

  • Return Value Logging:

    • Automatically logs the return value of any method it is applied to, providing immediate feedback on method outputs.
  • Custom Logging Function:

    • Supports a custom logging function, allowing users to define how the return values are logged.
  • Async and Sync Support:

    • Works with both synchronous and asynchronous methods, ensuring that return values from Promises are also logged.

Usage Example:

import LogReturnValue from "performance-decorators/debugging";

class ExampleService {
  @LogReturnValue()
  calculateSum(a: number, b: number): number {
    return a + b;
  }

  @LogReturnValue((value, methodName) => console.log(`[${methodName}] returned:`, value))
  async fetchData(url: string): Promise<any> {
    const response = await fetch(url);
    return response.json();
  }
}

const service = new ExampleService();
console.log(service.calculateSum(3, 4)); // Logs and returns 7
service.fetchData('https://api.example.com/data'); // Logs the returned JSON data

Full Changelog: 2.7.0...2.8.0