You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/cli/generators/extension/templates/src/providers/README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,18 +16,18 @@ The logger will log the URL, the parsed request parameters, and the result. The
16
16
17
17
TimerProvider is automatically bound to your Application's [Context](http://loopback.io/doc/en/lb4/Context.html) using the LogComponent which exports this provider with a binding key of `extension-starter.timer`. You can learn more about components in the [related resources section](#related-resources).
18
18
19
-
This provider makes availble to your application a timer function which given a start time _(given as an array [seconds, nanoseconds])_ can give you a total time elapsed since the start in milliseconds. The timer can also start timing if no start time is given. This is used by LogComponent to allow a user to time a Sequence.
19
+
This provider makes availble to your application a timer function which given a start time _(given as an array [seconds, nanoseconds])_ can give you a total time elapsed since the start in milliseconds. The timer can also start timing if no start time is given. This is used by LogComponent to allow a user to time a Sequence.
20
20
21
21
*NOTE:*_You can get the start time in the required format by using `this.logger.startTimer()`._
22
22
23
23
You can provide your own implementation of the elapsed time function by binding it to the binding key (accessible via `ExtensionStarterBindings`) as follows:
LogProvider can automatically be bound to your Application's Context using the LogComponent which exports the provider with a binding key of `extension-starter.actions.log`.
30
+
LogProvider can automatically be bound to your Application's Context using the LogComponent which exports the provider with a binding key of `extension-starter.actions.log`.
31
31
32
32
The key can be accessed by importing `ExtensionStarterBindings` as follows:
33
33
@@ -38,7 +38,7 @@ import {ExtensionStarterBindings} from 'HelloExtensions';
38
38
const key =ExtensionStarterBindings.LOG_ACTION;
39
39
```
40
40
41
-
LogProvider gives us a seuqence action and a `startTimer` function. In order to use the sequence action, you must define your own sequence as shown below.
41
+
LogProvider gives us a seuqence action and a `startTimer` function. In order to use the sequence action, you must define your own sequence as shown below.
42
42
43
43
**Example: Sequence**
44
44
```ts
@@ -85,9 +85,9 @@ Once a sequence has been written, we can just use that in our Application as fol
85
85
**Example: Application**
86
86
```ts
87
87
const app =newApplication({
88
-
sequence: LogSequence,
89
-
components: [LogComponent]
88
+
sequence: LogSequence
90
89
});
90
+
app.component(LogComponent);
91
91
92
92
// Now all requests handled by our sequence will be logged.
0 commit comments