Skip to content

Commit ba33a4a

Browse files
committed
Updated migrate.from.classic-to-modern-local-scope.md to fix the Markdown issue.
1 parent ce61a3d commit ba33a4a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/recipes/migrate.from.classic-to-modern-local-scope.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Modern mode offers several advantages:
3838

3939
Consider this component when running in Classic mode:
4040

41-
```javascript
41+
```cfml
4242
component {
4343
function createToken(id) {
4444
token = createUUID(); // Stored in variables scope
@@ -76,13 +76,13 @@ Or:
7676

7777
### 3. Application Level (Application.cfc)
7878

79-
```javascript
79+
```cfml
8080
this.localMode = "modern"; // or "classic"
8181
```
8282

8383
### 4. Function Level
8484

85-
```javascript
85+
```cfml
8686
function test() localMode="modern" {
8787
// Function body
8888
}
@@ -134,25 +134,25 @@ Variable Scope Cascading Write Detected: The variable [token] is being implicitl
134134

135135
For each occurrence, decide whether to:
136136

137-
1. **Add explicit variables scope** (if the variable should remain in the component's variables scope):
137+
1. **Add explicit `variables` scope** (if the variable should remain in the component's variables scope):
138138

139-
```javascript
140-
variables.token = createUUID();
141-
```
139+
```cfml
140+
variables.token = createUUID();
141+
```
142142

143-
2. **Add explicit local scope** (if the variable should be function-local):
143+
2. **Add explicit `local` scope** (if the variable should be function-local):
144144

145-
```javascript
146-
local.token = createUUID();
147-
```
145+
```cfml
146+
local.token = createUUID();
147+
```
148148

149149
### Common Patterns Requiring Attention
150150

151151
#### Component Properties
152152

153153
Properties meant to be stored at the component level need an explicit variables scope:
154154

155-
```javascript
155+
```cfml
156156
// Before
157157
function init(datasourceName) {
158158
datasourceName = arguments.datasourceName;
@@ -168,7 +168,7 @@ function init(datasourceName) {
168168

169169
Variables that should be local to a function call:
170170

171-
```javascript
171+
```cfml
172172
// Before
173173
function processItems(items) {
174174
result = [];

0 commit comments

Comments
 (0)