From 46dea7cbecf3cac8846f6972d9c3068921baeed8 Mon Sep 17 00:00:00 2001 From: Andrea Amorosi Date: Thu, 18 Aug 2022 14:56:21 +0200 Subject: [PATCH] chore: removed redundant export in docs (#1062) --- docs/core/tracer.md | 6 +++--- packages/tracer/src/Tracer.ts | 9 ++++----- .../tests/e2e/allFeatures.decorator.test.functionCode.ts | 2 +- .../e2e/asyncHandler.decorator.test.functionCode.ts | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/core/tracer.md b/docs/core/tracer.md index 8b4b49ed39..fc4b927d82 100644 --- a/docs/core/tracer.md +++ b/docs/core/tracer.md @@ -142,7 +142,7 @@ You can quickly start by importing the `Tracer` class, initialize it outside the } } - export const handlerClass = new Lambda(); + const handlerClass = new Lambda(); export const handler = handlerClass.handler.bind(handlerClass); // (1) ``` @@ -255,8 +255,8 @@ You can trace other Class methods using the `captureMethod` decorator or any arb } } - export const myFunction = new Lambda(); - export const handler = myFunction.handler.bind(myFunction); // (1) + const handlerClass = new Lambda(); + export const handler = myFunction.handler.bind(handlerClass); // (1) ``` 1. Binding your handler method allows your handler to access `this`. diff --git a/packages/tracer/src/Tracer.ts b/packages/tracer/src/Tracer.ts index c7faf1e3e0..9a572f45a3 100644 --- a/packages/tracer/src/Tracer.ts +++ b/packages/tracer/src/Tracer.ts @@ -66,7 +66,7 @@ import { Segment, Subsegment } from 'aws-xray-sdk-core'; * } * } * - * export const handlerClass = new Lambda(); + * const handlerClass = new Lambda(); * export const handler = handlerClass.handler.bind(handlerClass); * ``` * @@ -333,7 +333,7 @@ class Tracer extends Utility implements TracerInterface { * } * } * - * export const handlerClass = new Lambda(); + * const handlerClass = new Lambda(); * export const handler = handlerClass.handler.bind(handlerClass); * ``` * @@ -410,9 +410,8 @@ class Tracer extends Utility implements TracerInterface { * } * } * - * export const handlerClass = new Lambda(); - * export const myMethod = handlerClass.myMethod; - * export const handler = handlerClass.handler; + * const handlerClass = new Lambda(); + * export const handler = handlerClass.handler.bind(handlerClass);; * ``` * * @decorator Class diff --git a/packages/tracer/tests/e2e/allFeatures.decorator.test.functionCode.ts b/packages/tracer/tests/e2e/allFeatures.decorator.test.functionCode.ts index 6edce9e0dd..000faf567e 100644 --- a/packages/tracer/tests/e2e/allFeatures.decorator.test.functionCode.ts +++ b/packages/tracer/tests/e2e/allFeatures.decorator.test.functionCode.ts @@ -87,5 +87,5 @@ export class MyFunctionWithDecorator { } } -export const handlerClass = new MyFunctionWithDecorator(); +const handlerClass = new MyFunctionWithDecorator(); export const handler = handlerClass.handler.bind(handlerClass); \ No newline at end of file diff --git a/packages/tracer/tests/e2e/asyncHandler.decorator.test.functionCode.ts b/packages/tracer/tests/e2e/asyncHandler.decorator.test.functionCode.ts index ea1facd46c..ae4306ed30 100644 --- a/packages/tracer/tests/e2e/asyncHandler.decorator.test.functionCode.ts +++ b/packages/tracer/tests/e2e/asyncHandler.decorator.test.functionCode.ts @@ -82,5 +82,5 @@ export class MyFunctionWithDecorator { } } -export const handlerClass = new MyFunctionWithDecorator(); +const handlerClass = new MyFunctionWithDecorator(); export const handler = handlerClass.handler.bind(handlerClass); \ No newline at end of file