@@ -77,8 +77,9 @@ When exporting an async function, you can also configure an output binding to ta
77
77
If your function is synchronous (doesn't return a Promise), you must pass the ` context ` object, as calling ` context.done ` is required for correct use.
78
78
79
79
``` javascript
80
- // You should include context, other arguments are optional
81
- module .exports = async function (context , myTrigger , myInput , myOtherInput ) {
80
+ // You should include `context`
81
+ // Other arguments like `myTrigger` are optional
82
+ module .exports = function (context , myTrigger , myInput , myOtherInput ) {
82
83
// function logic goes here :)
83
84
context .done ();
84
85
};
@@ -273,15 +274,17 @@ module.exports = async function (context, req) {
273
274
The ** context.done** method is used by 1.x synchronous functions. In 2.x, 3.x, and 4.x, the function should be marked as async even if there is no awaited function call inside the function, and the function doesn't need to call context.done to indicate the end of the function.
274
275
275
276
``` javascript
276
- // 1.x Synchronous code only
277
- // Even though we set myOutput to have:
278
- // -> text: 'hello world', number: 123
279
- context .bindings .myOutput = { text: ' hello world' , number: 123 };
280
-
281
- // If we pass an object to the done function...
282
- context .done (null , { myOutput: { text: ' hello there, world' , noNumber: true }});
283
- // the done method overwrites the myOutput binding to be:
284
- // -> text: 'hello there, world', noNumber: true
277
+ module .exports = function (context , req ) {
278
+ // 1.x Synchronous code only
279
+ // Even though we set myOutput to have:
280
+ // -> text: 'hello world', number: 123
281
+ context .bindings .myOutput = { text: ' hello world' , number: 123 };
282
+
283
+ // If we pass an object to the done function...
284
+ context .done (null , { myOutput: { text: ' hello there, world' , noNumber: true }});
285
+ // the done method overwrites the myOutput binding to be:
286
+ // -> text: 'hello there, world', noNumber: true
287
+ }
285
288
```
286
289
287
290
@@ -560,6 +563,7 @@ module.exports = async function(context) {
560
563
// Using our imported underscore.js library
561
564
const matched_names = _
562
565
.where (context .bindings .myInput .names , {first: ' Carla' });
566
+ }
563
567
```
564
568
565
569
> [ !NOTE]
0 commit comments