Skip to content

Commit b9f7e48

Browse files
committed
Fix casing of variables in docs
1 parent fd723d3 commit b9f7e48

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

ASYNC.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Twig.async.forEach(arr, function(value, index) {
116116

117117
## Switching render mode
118118

119-
The rendering mode of Twig.js internally is determined by the `allow_async` argument that can be passed into `Twig.expression.parse`, `Twig.logic.parse`, `Twig.parse` and `Twig.Template.render`. Detecting if at any point code runs asynchronously is explained in [detecting asynchronous behaviour](#detecting-asynchronous-behaviour).
119+
The rendering mode of Twig.js internally is determined by the `allowAsync` argument that can be passed into `Twig.expression.parse`, `Twig.logic.parse`, `Twig.parse` and `Twig.Template.render`. Detecting if at any point code runs asynchronously is explained in [detecting asynchronous behaviour](#detecting-asynchronous-behaviour).
120120

121121
For the end user switching between synchronous and asynchronous is as simple as using a different method on the template instance.
122122

@@ -157,10 +157,10 @@ var template = twig({
157157

158158
The pattern used to detect asynchronous behaviour is the same everywhere it is used and follows a simple pattern.
159159

160-
1. Set a variable `is_async = true`
160+
1. Set a variable `isAsync = true`
161161
2. Run the promise chain that might contain some asynchronous behaviour.
162-
3. As the last method in the promise chain set `is_async = false`
163-
4. Underneath the promise chain test whether `is_async` is `true`
162+
3. As the last method in the promise chain set `isAsync = false`
163+
4. Underneath the promise chain test whether `isAsync` is `true`
164164

165165
This pattern works because the last method in the chain will be executed in the next run of the eventloop (`setTimeout`/`setImmediate`).
166166

@@ -169,7 +169,7 @@ This pattern works because the last method in the chain will be executed in the
169169
**Synchronous promises only**
170170

171171
```javascript
172-
var is_async = true;
172+
var isAsync = true;
173173

174174
Twig.Promise.resolve()
175175
.then(function() {
@@ -178,10 +178,10 @@ Twig.Promise.resolve()
178178
return 'hello world';
179179
})
180180
.then(function() {
181-
is_async = false;
181+
isAsync = false;
182182
});
183183

184-
if (is_async)
184+
if (isAsync)
185185
console.log('method ran asynchronous');
186186

187187
console.log('method ran synchronous');
@@ -195,18 +195,18 @@ console.log('method ran synchronous');
195195
**Mixed promises**
196196

197197
```javascript
198-
var is_async = true;
198+
var isAsync = true;
199199

200200
Twig.Promise.resolve()
201201
.then(function() {
202202
// We run our work in here such to allow for asynchronous work
203203
return Promise.resolve('hello world');
204204
})
205205
.then(function() {
206-
is_async = false;
206+
isAsync = false;
207207
});
208208

209-
if (is_async)
209+
if (isAsync)
210210
console.log('method ran asynchronous');
211211

212212
console.log('method ran synchronous');

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var Twig = require("twig"),
9292

9393
// This section is optional and used to configure twig.
9494
app.set("twig options", {
95-
allow_async: true, // Allow asynchronous compiling
95+
allowAsync: true, // Allow asynchronous compiling
9696
strict_variables: false
9797
});
9898

0 commit comments

Comments
 (0)