Skip to content

Commit 0dabb17

Browse files
Merge pull request #258370 from castrodd/main
Move warmup trigger code samples
2 parents e291f99 + 46cf955 commit 0dabb17

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

articles/azure-functions/functions-bindings-warmup.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,9 @@ public void warmup( @WarmupTrigger Object warmupContext, ExecutionContext contex
8484

8585
# [Model v4](#tab/nodejs-v4)
8686

87-
The following example shows a warmup trigger [JavaScript function](functions-reference-node.md) that runs on each new instance when added to your app.
87+
The following example shows a [JavaScript function](functions-reference-node.md) with a warmup trigger that runs on each new instance when added to your app:
8888

89-
```javascript
90-
import { app } from "@azure/functions";
91-
92-
app.warmup('warmupTrigger1', {
93-
handler: (warmupContext, context) => {
94-
context.log('Function App instance is warm.');
95-
},
96-
});
97-
```
89+
:::code language="javascript" source="~/azure-functions-nodejs-v4/js/src/functions/warmupTrigger1.js" :::
9890

9991
# [Model v3](#tab/nodejs-v3)
10092

@@ -124,27 +116,21 @@ module.exports = async function (warmupContext, context) {
124116
};
125117
```
126118

119+
---
120+
127121
::: zone-end
128122
::: zone pivot="programming-language-typescript"
129123
# [Model v4](#tab/nodejs-v4)
130124

131-
The following example shows a warmup trigger [JavaScript function](functions-reference-node.md) that runs on each new instance when added to your app.
125+
The following example shows a [TypeScript function](functions-reference-node.md) with a warmup trigger that runs on each new instance when added to your app:
132126

133-
```TypeScript
134-
import { app, InvocationContext, WarmupContextOptions } from "@azure/functions";
135-
136-
export async function warmupFunction(warmupContext: WarmupContextOptions, context: InvocationContext): Promise<void> {
137-
context.log('Function App instance is warm.');
138-
}
139-
140-
app.warmup('warmup', {
141-
handler: warmupFunction,
142-
});
143-
```
127+
:::code language="typescript" source="~/azure-functions-nodejs-v4/ts/src/functions/warmupTrigger1.ts" :::
144128

145129
# [Model v3](#tab/nodejs-v3)
146130
TypeScript samples aren't documented for model v3.
147131

132+
---
133+
148134
::: zone-end
149135
::: zone pivot="programming-language-powershell"
150136
Here's the *function.json* file:

0 commit comments

Comments
 (0)