@maccesar/titools 2.2.4 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -23
- package/lib/commands/update.js +4 -12
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +31 -31
- package/skills/alloy-guides/references/CONCEPTS.md +3 -3
- package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/MODELS.md +6 -6
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +27 -27
- package/skills/alloy-howtos/references/best_practices.md +9 -9
- package/skills/alloy-howtos/references/cli_reference.md +14 -14
- package/skills/alloy-howtos/references/config_files.md +16 -16
- package/skills/alloy-howtos/references/custom_tags.md +16 -16
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
- package/skills/alloy-howtos/references/samples.md +19 -19
- package/skills/purgetss/SKILL.md +11 -1
- package/skills/purgetss/references/animation-system.md +1 -1
- package/skills/purgetss/references/cli-commands.md +3 -3
- package/skills/purgetss/references/customization-deep-dive.md +1 -1
- package/skills/purgetss/references/dynamic-component-creation.md +1 -1
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +8 -1
- package/skills/purgetss/references/migration-guide.md +4 -0
- package/skills/purgetss/references/tikit-components.md +193 -204
- package/skills/purgetss/references/ui-ux-design.md +1 -1
- package/skills/ti-expert/SKILL.md +78 -118
- package/skills/ti-expert/references/alloy-builtins.md +18 -18
- package/skills/ti-expert/references/alloy-structure.md +21 -21
- package/skills/ti-expert/references/anti-patterns.md +15 -15
- package/skills/ti-expert/references/cli-expert.md +15 -15
- package/skills/ti-expert/references/code-conventions.md +38 -38
- package/skills/ti-expert/references/contracts.md +8 -8
- package/skills/ti-expert/references/controller-patterns.md +14 -14
- package/skills/ti-expert/references/error-handling.md +11 -11
- package/skills/ti-expert/references/examples.md +12 -12
- package/skills/ti-expert/references/migration-patterns.md +24 -24
- package/skills/ti-expert/references/patterns.md +10 -10
- package/skills/ti-expert/references/performance-listview.md +16 -16
- package/skills/ti-expert/references/performance-optimization.md +41 -41
- package/skills/ti-expert/references/security-device.md +22 -22
- package/skills/ti-expert/references/security-fundamentals.md +19 -19
- package/skills/ti-expert/references/state-management.md +33 -33
- package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
- package/skills/ti-expert/references/testing-unit.md +24 -24
- package/skills/ti-expert/references/theming.md +15 -15
- package/skills/ti-guides/SKILL.md +58 -60
- package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
- package/skills/ti-guides/references/android-manifest.md +15 -15
- package/skills/ti-guides/references/app-distribution.md +70 -166
- package/skills/ti-guides/references/application-frameworks.md +96 -114
- package/skills/ti-guides/references/cli-reference.md +294 -294
- package/skills/ti-guides/references/coding-best-practices.md +42 -33
- package/skills/ti-guides/references/commonjs-advanced.md +57 -51
- package/skills/ti-guides/references/hello-world.md +36 -36
- package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
- package/skills/ti-guides/references/javascript-primer.md +83 -101
- package/skills/ti-guides/references/reserved-words.md +9 -9
- package/skills/ti-guides/references/resources.md +75 -83
- package/skills/ti-guides/references/style-and-conventions.md +35 -28
- package/skills/ti-guides/references/tiapp-config.md +110 -74
- package/skills/ti-howtos/SKILL.md +88 -92
- package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
- package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
- package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
- package/skills/ti-howtos/references/cross-platform-development.md +115 -136
- package/skills/ti-howtos/references/debugging-profiling.md +167 -181
- package/skills/ti-howtos/references/extending-titanium.md +121 -121
- package/skills/ti-howtos/references/google-maps-v2.md +84 -82
- package/skills/ti-howtos/references/ios-map-kit.md +65 -60
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
- package/skills/ti-howtos/references/local-data-sources.md +79 -78
- package/skills/ti-howtos/references/location-and-maps.md +116 -120
- package/skills/ti-howtos/references/media-apis.md +87 -86
- package/skills/ti-howtos/references/notification-services.md +250 -260
- package/skills/ti-howtos/references/remote-data-sources.md +98 -93
- package/skills/ti-howtos/references/tutorials.md +226 -216
- package/skills/ti-howtos/references/using-modules.md +73 -102
- package/skills/ti-howtos/references/web-content-integration.md +101 -103
- package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
- package/skills/ti-ui/SKILL.md +85 -85
- package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
- package/skills/ti-ui/references/animation-and-matrices.md +79 -79
- package/skills/ti-ui/references/application-structures.md +96 -99
- package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
- package/skills/ti-ui/references/event-handling.md +58 -58
- package/skills/ti-ui/references/gestures.md +62 -64
- package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
- package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
- package/skills/ti-ui/references/listviews-and-performance.md +107 -107
- package/skills/ti-ui/references/orientation.md +87 -88
- package/skills/ti-ui/references/platform-ui-android.md +87 -81
- package/skills/ti-ui/references/platform-ui-ios.md +63 -61
- package/skills/ti-ui/references/scrolling-views.md +29 -29
- package/skills/ti-ui/references/tableviews.md +56 -56
|
@@ -1,66 +1,59 @@
|
|
|
1
|
-
# JavaScript
|
|
1
|
+
# JavaScript development primer
|
|
2
2
|
|
|
3
3
|
Essential JavaScript concepts, resources, and best practices for Titanium development.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
2. [Learning Resources](#learning-resources)
|
|
7
|
-
3. [Best Practices](#best-practices)
|
|
8
|
-
4. [Common Patterns](#common-patterns)
|
|
5
|
+
## JavaScript overview
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## JavaScript Overview
|
|
7
|
+
JavaScript is the language of Titanium. It is lightweight and dynamic, with object-oriented and functional features.
|
|
13
8
|
|
|
14
|
-
JavaScript
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- One of the most widely deployed languages (every web browser)
|
|
18
|
-
- Large community of developers
|
|
9
|
+
Why JavaScript for Titanium?
|
|
10
|
+
- Widely deployed (every web browser)
|
|
11
|
+
- Large community
|
|
19
12
|
- Dynamic typing with duck typing
|
|
20
13
|
- Functional programming support
|
|
21
14
|
- Convenient object literal notation
|
|
22
15
|
- Closures for encapsulation
|
|
23
16
|
- Small learning curve
|
|
24
17
|
|
|
25
|
-
|
|
26
|
-
- No DOM manipulation (that
|
|
27
|
-
- Access to native APIs via Titanium namespace
|
|
18
|
+
JavaScript in Titanium:
|
|
19
|
+
- No DOM manipulation (that is web-specific)
|
|
20
|
+
- Access to native APIs via the Titanium namespace
|
|
28
21
|
- ECMAScript 5/6 compliant
|
|
29
|
-
- Same JavaScript you use
|
|
22
|
+
- Same JavaScript you use on the web, but targeting mobile apps
|
|
30
23
|
|
|
31
24
|
---
|
|
32
25
|
|
|
33
|
-
## Learning
|
|
26
|
+
## Learning resources
|
|
34
27
|
|
|
35
|
-
### Online
|
|
28
|
+
### Online courses
|
|
36
29
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
30
|
+
- Codecademy: https://www.codecademy.com/learn/introduction-to-javascript
|
|
31
|
+
- Stanford CS101: http://www.stanford.edu/class/cs101/
|
|
32
|
+
- edX: https://www.edx.org/learn/javascript
|
|
40
33
|
|
|
41
|
-
### Online
|
|
34
|
+
### Online books and references
|
|
42
35
|
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
36
|
+
- Eloquent JavaScript: https://eloquentjavascript.net/
|
|
37
|
+
- MDN JavaScript Guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
|
|
38
|
+
- Douglas Crockford's resources: http://javascript.crockford.com/
|
|
39
|
+
- JavaScript in 10 Minutes: https://github.com/spencertipping/js-in-ten-minutes
|
|
40
|
+
- Google JavaScript Style Guide: https://google.github.io/styleguide/jsguide.html
|
|
41
|
+
- Learning Advanced JavaScript: http://ejohn.org/apps/learn/
|
|
49
42
|
|
|
50
|
-
### Print
|
|
43
|
+
### Print books (recommended)
|
|
51
44
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
45
|
+
- JavaScript: The Good Parts (Douglas Crockford)
|
|
46
|
+
- JavaScript: The Definitive Guide (David Flanagan)
|
|
47
|
+
- JavaScript Patterns (Stoyan Stefanov)
|
|
48
|
+
- Eloquent JavaScript (Marijn Haverbeke)
|
|
56
49
|
|
|
57
50
|
---
|
|
58
51
|
|
|
59
|
-
## Best
|
|
52
|
+
## Best practices
|
|
60
53
|
|
|
61
|
-
###
|
|
54
|
+
### Do not pollute the global scope
|
|
62
55
|
|
|
63
|
-
|
|
56
|
+
Bad: everything in global scope
|
|
64
57
|
```javascript
|
|
65
58
|
const key = 'value';
|
|
66
59
|
const foo = 'bar';
|
|
@@ -75,9 +68,9 @@ function info(msg) {
|
|
|
75
68
|
}
|
|
76
69
|
```
|
|
77
70
|
|
|
78
|
-
|
|
71
|
+
Good: single namespace
|
|
79
72
|
```javascript
|
|
80
|
-
const myapp = {}; // Only
|
|
73
|
+
const myapp = {}; // Only one global variable
|
|
81
74
|
|
|
82
75
|
myapp.key = 'value';
|
|
83
76
|
|
|
@@ -100,9 +93,9 @@ myapp.dosomething = (foo) => {
|
|
|
100
93
|
myapp.info('Hello World');
|
|
101
94
|
```
|
|
102
95
|
|
|
103
|
-
### Use
|
|
96
|
+
### Use strict equality
|
|
104
97
|
|
|
105
|
-
|
|
98
|
+
Bad: `==` converts types
|
|
106
99
|
```javascript
|
|
107
100
|
const testme = '1';
|
|
108
101
|
if (testme == 1) {
|
|
@@ -110,7 +103,7 @@ if (testme == 1) {
|
|
|
110
103
|
}
|
|
111
104
|
```
|
|
112
105
|
|
|
113
|
-
|
|
106
|
+
Good: `===` checks both type and value
|
|
114
107
|
```javascript
|
|
115
108
|
const testme = '1';
|
|
116
109
|
if (testme === 1) {
|
|
@@ -118,9 +111,9 @@ if (testme === 1) {
|
|
|
118
111
|
}
|
|
119
112
|
```
|
|
120
113
|
|
|
121
|
-
### Efficient
|
|
114
|
+
### Efficient loops
|
|
122
115
|
|
|
123
|
-
|
|
116
|
+
Bad: checks `array.length` every iteration
|
|
124
117
|
```javascript
|
|
125
118
|
const names = ['Jeff', 'Nolan', 'Marshall', 'Don'];
|
|
126
119
|
for (let i = 0; i < names.length; i++) {
|
|
@@ -128,7 +121,7 @@ for (let i = 0; i < names.length; i++) {
|
|
|
128
121
|
}
|
|
129
122
|
```
|
|
130
123
|
|
|
131
|
-
|
|
124
|
+
Good: cache length
|
|
132
125
|
```javascript
|
|
133
126
|
const names = ['Jeff', 'Nolan', 'Marshall', 'Don'];
|
|
134
127
|
for (let i = 0, j = names.length; i < j; i++) {
|
|
@@ -136,33 +129,33 @@ for (let i = 0, j = names.length; i < j; i++) {
|
|
|
136
129
|
}
|
|
137
130
|
```
|
|
138
131
|
|
|
139
|
-
This is especially important
|
|
132
|
+
This is especially important with Titanium proxy objects, where checking length on each iteration has extra overhead.
|
|
140
133
|
|
|
141
|
-
|
|
134
|
+
Even better: ES6 `for...of`
|
|
142
135
|
```javascript
|
|
143
136
|
for (const name of names) {
|
|
144
137
|
process(name);
|
|
145
138
|
}
|
|
146
139
|
```
|
|
147
140
|
|
|
148
|
-
### Use var/let/const
|
|
141
|
+
### Use var/let/const correctly
|
|
149
142
|
|
|
150
143
|
```javascript
|
|
151
|
-
// ES5:
|
|
144
|
+
// ES5: use var (function-scoped)
|
|
152
145
|
var x = 10;
|
|
153
146
|
|
|
154
|
-
// ES6+:
|
|
147
|
+
// ES6+: use let and const (block-scoped)
|
|
155
148
|
let y = 20; // Can be reassigned
|
|
156
149
|
const z = 30; // Cannot be reassigned
|
|
157
150
|
```
|
|
158
151
|
|
|
159
152
|
---
|
|
160
153
|
|
|
161
|
-
## Common
|
|
154
|
+
## Common patterns
|
|
162
155
|
|
|
163
|
-
### Ternary
|
|
156
|
+
### Ternary operator
|
|
164
157
|
|
|
165
|
-
Compact conditional assignment. Value after `?` is
|
|
158
|
+
Compact conditional assignment. Value after `?` is used if the condition is true; value after `:` if false.
|
|
166
159
|
|
|
167
160
|
```javascript
|
|
168
161
|
// Instead of this:
|
|
@@ -177,7 +170,7 @@ if (somecondition === somevalue) {
|
|
|
177
170
|
const xyz = (somecondition === somevalue) ? 'abc' : '123';
|
|
178
171
|
```
|
|
179
172
|
|
|
180
|
-
### Multiple
|
|
173
|
+
### Multiple variable declarations
|
|
181
174
|
|
|
182
175
|
Use commas instead of multiple `var` statements:
|
|
183
176
|
|
|
@@ -193,18 +186,18 @@ const foo = true,
|
|
|
193
186
|
great = 42;
|
|
194
187
|
```
|
|
195
188
|
|
|
196
|
-
### Self-
|
|
189
|
+
### Self-calling functions (IIFE)
|
|
197
190
|
|
|
198
191
|
Encapsulate private variables and functions:
|
|
199
192
|
|
|
200
|
-
|
|
193
|
+
Ambiguous (not recommended):
|
|
201
194
|
```javascript
|
|
202
195
|
const myValue = (() => {
|
|
203
196
|
return someValue;
|
|
204
197
|
})(); // Looks like assigning function, not result
|
|
205
198
|
```
|
|
206
199
|
|
|
207
|
-
|
|
200
|
+
Clear (recommended):
|
|
208
201
|
```javascript
|
|
209
202
|
const myValue = (() => {
|
|
210
203
|
// Private variables here
|
|
@@ -214,11 +207,11 @@ const myValue = (() => {
|
|
|
214
207
|
})(); // Clearly returns result, not function
|
|
215
208
|
```
|
|
216
209
|
|
|
217
|
-
### CommonJS
|
|
210
|
+
### CommonJS modules
|
|
218
211
|
|
|
219
212
|
Use `require()` for modular code:
|
|
220
213
|
|
|
221
|
-
|
|
214
|
+
myModule.js:
|
|
222
215
|
```javascript
|
|
223
216
|
// Private
|
|
224
217
|
const privateData = 'secret';
|
|
@@ -234,7 +227,7 @@ exports.publicMethod = () => {
|
|
|
234
227
|
};
|
|
235
228
|
```
|
|
236
229
|
|
|
237
|
-
|
|
230
|
+
app.js:
|
|
238
231
|
```javascript
|
|
239
232
|
const myModule = require('myModule');
|
|
240
233
|
myModule.publicMethod();
|
|
@@ -242,11 +235,11 @@ myModule.publicMethod();
|
|
|
242
235
|
|
|
243
236
|
---
|
|
244
237
|
|
|
245
|
-
## ES6+
|
|
238
|
+
## ES6+ features in Titanium
|
|
246
239
|
|
|
247
|
-
Titanium supports modern JavaScript (ES6/ES7+). Use these features
|
|
240
|
+
Titanium supports modern JavaScript (ES6/ES7+). Use these features.
|
|
248
241
|
|
|
249
|
-
|
|
242
|
+
Arrow functions:
|
|
250
243
|
```javascript
|
|
251
244
|
// Old
|
|
252
245
|
const self = this;
|
|
@@ -260,7 +253,7 @@ someArray.forEach((item) => {
|
|
|
260
253
|
});
|
|
261
254
|
```
|
|
262
255
|
|
|
263
|
-
|
|
256
|
+
Template literals:
|
|
264
257
|
```javascript
|
|
265
258
|
// Old
|
|
266
259
|
const message = 'Hello ' + name + ', you have ' + count + ' messages';
|
|
@@ -269,7 +262,7 @@ const message = 'Hello ' + name + ', you have ' + count + ' messages';
|
|
|
269
262
|
const message = `Hello ${name}, you have ${count} messages`;
|
|
270
263
|
```
|
|
271
264
|
|
|
272
|
-
|
|
265
|
+
Destructuring:
|
|
273
266
|
```javascript
|
|
274
267
|
// Old
|
|
275
268
|
const width = e.source.size.width;
|
|
@@ -279,17 +272,17 @@ const height = e.source.size.height;
|
|
|
279
272
|
const {width, height} = e.source.size;
|
|
280
273
|
```
|
|
281
274
|
|
|
282
|
-
|
|
275
|
+
Spread operator:
|
|
283
276
|
```javascript
|
|
284
277
|
// Old
|
|
285
278
|
const arr = [1, 2, 3];
|
|
286
279
|
const arr2 = arr.concat([4, 5]);
|
|
287
280
|
|
|
288
281
|
// New
|
|
289
|
-
|
|
282
|
+
const arr2 = [...arr, 4, 5];
|
|
290
283
|
```
|
|
291
284
|
|
|
292
|
-
|
|
285
|
+
Classes:
|
|
293
286
|
```javascript
|
|
294
287
|
class Person {
|
|
295
288
|
constructor(name) {
|
|
@@ -304,19 +297,19 @@ class Person {
|
|
|
304
297
|
|
|
305
298
|
---
|
|
306
299
|
|
|
307
|
-
## Gotchas to
|
|
300
|
+
## Gotchas to avoid
|
|
308
301
|
|
|
309
|
-
### Variable
|
|
302
|
+
### Variable hoisting
|
|
310
303
|
|
|
311
|
-
|
|
304
|
+
Problem: variables are hoisted to function scope.
|
|
312
305
|
```javascript
|
|
313
306
|
function test() {
|
|
314
|
-
console.log(myVar); // undefined (not error
|
|
307
|
+
console.log(myVar); // undefined (not error)
|
|
315
308
|
var myVar = 'value';
|
|
316
309
|
}
|
|
317
310
|
```
|
|
318
311
|
|
|
319
|
-
|
|
312
|
+
Solution: declare variables at the top of the function.
|
|
320
313
|
```javascript
|
|
321
314
|
function test() {
|
|
322
315
|
let myVar; // Declare first
|
|
@@ -325,88 +318,77 @@ function test() {
|
|
|
325
318
|
}
|
|
326
319
|
```
|
|
327
320
|
|
|
328
|
-
### Global
|
|
321
|
+
### Global variable accidents
|
|
329
322
|
|
|
330
|
-
|
|
323
|
+
Problem: forgetting `var` creates a global variable.
|
|
331
324
|
```javascript
|
|
332
325
|
function test() {
|
|
333
|
-
myVar = 'value'; // Creates
|
|
326
|
+
myVar = 'value'; // Creates a global variable
|
|
334
327
|
}
|
|
335
328
|
```
|
|
336
329
|
|
|
337
|
-
|
|
330
|
+
Solution: always use `var`, `let`, or `const`.
|
|
338
331
|
```javascript
|
|
339
332
|
function test() {
|
|
340
|
-
const myVar = 'value';
|
|
333
|
+
const myVar = 'value';
|
|
341
334
|
}
|
|
342
335
|
```
|
|
343
336
|
|
|
344
|
-
### The `this`
|
|
337
|
+
### The `this` context
|
|
345
338
|
|
|
346
|
-
|
|
339
|
+
Problem: `this` changes in different contexts.
|
|
347
340
|
```javascript
|
|
348
341
|
const obj = {
|
|
349
342
|
value: 42,
|
|
350
343
|
getValue: function() {
|
|
351
344
|
setTimeout(function() {
|
|
352
|
-
console.log(this.value); // undefined
|
|
345
|
+
console.log(this.value); // undefined
|
|
353
346
|
}, 100);
|
|
354
347
|
}
|
|
355
348
|
};
|
|
356
349
|
```
|
|
357
350
|
|
|
358
|
-
|
|
351
|
+
Solution 1: store `this`.
|
|
359
352
|
```javascript
|
|
360
353
|
const obj = {
|
|
361
354
|
value: 42,
|
|
362
355
|
getValue: function() {
|
|
363
356
|
const self = this;
|
|
364
357
|
setTimeout(function() {
|
|
365
|
-
console.log(self.value); // Works
|
|
358
|
+
console.log(self.value); // Works
|
|
366
359
|
}, 100);
|
|
367
360
|
}
|
|
368
361
|
};
|
|
369
362
|
```
|
|
370
363
|
|
|
371
|
-
|
|
364
|
+
Solution 2: arrow function (ES6).
|
|
372
365
|
```javascript
|
|
373
366
|
const obj = {
|
|
374
367
|
value: 42,
|
|
375
368
|
getValue() {
|
|
376
369
|
setTimeout(() => {
|
|
377
|
-
console.log(this.value); // Works
|
|
370
|
+
console.log(this.value); // Works
|
|
378
371
|
}, 100);
|
|
379
372
|
}
|
|
380
373
|
};
|
|
381
374
|
```
|
|
382
375
|
|
|
383
|
-
### Semicolon
|
|
376
|
+
### Semicolon insertion
|
|
384
377
|
|
|
385
|
-
JavaScript automatically inserts semicolons
|
|
378
|
+
JavaScript automatically inserts semicolons and can cause bugs.
|
|
386
379
|
|
|
387
|
-
|
|
380
|
+
Dangerous:
|
|
388
381
|
```javascript
|
|
389
382
|
return
|
|
390
383
|
{
|
|
391
384
|
name: 'Test'
|
|
392
385
|
};
|
|
393
|
-
// Returns undefined
|
|
386
|
+
// Returns undefined
|
|
394
387
|
```
|
|
395
388
|
|
|
396
|
-
|
|
389
|
+
Safe:
|
|
397
390
|
```javascript
|
|
398
391
|
return {
|
|
399
392
|
name: 'Test'
|
|
400
393
|
};
|
|
401
|
-
// Or put opening brace on same line
|
|
402
|
-
return { name: 'Test' };
|
|
403
394
|
```
|
|
404
|
-
|
|
405
|
-
---
|
|
406
|
-
|
|
407
|
-
## Resources
|
|
408
|
-
|
|
409
|
-
- **Alloy Framework:** See `alloy-guides` skill
|
|
410
|
-
- **CommonJS Modules:** See `commonjs-advanced.md`
|
|
411
|
-
- **Coding Best Practices:** See `coding-best-practices.md`
|
|
412
|
-
- **Style Guide:** See `style-and-conventions.md`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Reserved
|
|
1
|
+
# Reserved words in Titanium
|
|
2
2
|
|
|
3
|
-
## ECMAScript
|
|
3
|
+
## ECMAScript reserved keywords
|
|
4
4
|
|
|
5
|
-
These keywords cannot be used as variable, function, method, or object identifiers
|
|
5
|
+
These keywords cannot be used as variable, function, method, or object identifiers under the ECMAScript specification:
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
abstract, boolean, break, byte, case, catch, char, class, const, continue,
|
|
@@ -13,22 +13,22 @@ static, super, switch, synchronized, this, throw, throws, transient, try,
|
|
|
13
13
|
typeof, var, void, volatile, while, with, yield
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
## iOS Objective-C
|
|
16
|
+
## iOS Objective-C reserved words
|
|
17
17
|
|
|
18
|
-
These keywords are exposed from Objective-C and
|
|
18
|
+
These keywords are exposed from Objective-C and should not be used as identifiers on iOS:
|
|
19
19
|
|
|
20
20
|
```
|
|
21
21
|
_configure, _destroy, _initProperties, autorelease, deadlock, dealloc,
|
|
22
22
|
description, id, init, release, startup
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
## Alloy
|
|
25
|
+
## Alloy reserved words
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Do not use double underscore prefixes on variables, properties, or function names (for example, `__foo`). These are reserved for Alloy's internal use.
|
|
28
28
|
|
|
29
|
-
## Best
|
|
29
|
+
## Best practice
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Avoid these reserved words when naming:
|
|
32
32
|
- Variables
|
|
33
33
|
- Functions
|
|
34
34
|
- Methods
|