@maccesar/titools 5.2.5 → 5.4.0

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.
Files changed (138) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +58 -97
  3. package/agents/ti-pro.md +4 -2
  4. package/commands/ti-audit.md +7 -5
  5. package/docs/examples.md +24 -13
  6. package/docs/knowledge-index.md +2 -1
  7. package/lib/config.js +1 -0
  8. package/package.json +1 -1
  9. package/skills/alloy-guides/SKILL.md +18 -179
  10. package/skills/alloy-guides/references/CLI_TASKS.md +17 -216
  11. package/skills/alloy-guides/references/CONCEPTS.md +27 -162
  12. package/skills/alloy-guides/references/CONTROLLERS.md +38 -236
  13. package/skills/alloy-guides/references/MODELS.md +47 -723
  14. package/skills/alloy-guides/references/MODELS_ADVANCED.md +21 -482
  15. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +12 -222
  16. package/skills/alloy-guides/references/VIEWS_STYLES.md +39 -358
  17. package/skills/alloy-guides/references/VIEWS_XML.md +36 -552
  18. package/skills/alloy-guides/references/WIDGETS.md +49 -127
  19. package/skills/alloy-howtos/SKILL.md +14 -169
  20. package/skills/alloy-howtos/references/best_practices.md +9 -113
  21. package/skills/alloy-howtos/references/cli_reference.md +18 -223
  22. package/skills/alloy-howtos/references/config_files.md +50 -133
  23. package/skills/alloy-howtos/references/debugging_troubleshooting.md +19 -63
  24. package/skills/alloy-howtos/references/samples.md +21 -138
  25. package/skills/ti-api/SKILL.md +10 -2
  26. package/skills/ti-api/references/api-android.md +36 -2
  27. package/skills/ti-api/references/api-app-platform.md +39 -3
  28. package/skills/ti-api/references/api-core.md +50 -18
  29. package/skills/ti-api/references/api-data-network.md +49 -35
  30. package/skills/ti-api/references/api-media.md +45 -27
  31. package/skills/ti-api/references/api-services.md +39 -9
  32. package/skills/ti-api/references/api-ui-android.md +33 -13
  33. package/skills/ti-api/references/api-ui-extras.md +41 -15
  34. package/skills/ti-api/references/api-ui-ios-animator.md +42 -26
  35. package/skills/ti-api/references/api-ui-ios.md +74 -2
  36. package/skills/ti-api/references/api-ui-lists.md +32 -16
  37. package/skills/ti-api/references/api-ui-text-input.md +34 -17
  38. package/skills/ti-api/references/api-ui-views.md +27 -1
  39. package/skills/ti-api/references/api-ui-windows-navigation.md +32 -18
  40. package/skills/ti-api/references/api-xml-global.md +66 -16
  41. package/skills/ti-create-release/SKILL.md +98 -0
  42. package/skills/ti-create-release/references/module-discovery.md +69 -0
  43. package/skills/ti-expert/references/adaptive-layouts.md +1 -1
  44. package/skills/ti-guides/SKILL.md +37 -76
  45. package/skills/ti-guides/references/advanced-data-and-images.md +122 -126
  46. package/skills/ti-guides/references/android-manifest.md +24 -83
  47. package/skills/ti-guides/references/app-distribution.md +31 -377
  48. package/skills/ti-guides/references/application-frameworks.md +127 -335
  49. package/skills/ti-guides/references/cli-reference.md +184 -633
  50. package/skills/ti-guides/references/commonjs-advanced.md +81 -231
  51. package/skills/ti-guides/references/compatibility-matrix.md +36 -75
  52. package/skills/ti-guides/references/hello-world.md +95 -70
  53. package/skills/ti-guides/references/hyperloop-native-access.md +52 -448
  54. package/skills/ti-guides/references/resources.md +174 -142
  55. package/skills/ti-guides/references/sdk-release-notes.md +28 -71
  56. package/skills/ti-guides/references/tiapp-config.md +222 -598
  57. package/skills/ti-howtos/SKILL.md +23 -123
  58. package/skills/ti-howtos/references/cross-platform-development.md +119 -324
  59. package/skills/ti-howtos/references/debugging-profiling.md +77 -445
  60. package/skills/ti-howtos/references/extending-titanium.md +199 -673
  61. package/skills/ti-howtos/references/local-data-sources.md +87 -300
  62. package/skills/ti-howtos/references/location-and-maps.md +86 -213
  63. package/skills/ti-howtos/references/media-apis.md +103 -223
  64. package/skills/ti-howtos/references/notification-services.md +86 -506
  65. package/skills/ti-howtos/references/remote-data-sources.md +97 -316
  66. package/skills/ti-howtos/references/using-modules.md +77 -133
  67. package/skills/ti-synthengine/SKILL.md +62 -111
  68. package/skills/ti-synthengine/assets/example/README.md +50 -59
  69. package/skills/ti-synthengine/assets/example/app.js +67 -65
  70. package/skills/ti-synthengine/assets/example/lib/sequenceOwner.js +39 -40
  71. package/skills/ti-synthengine/assets/example/lib/soundPreset.js +34 -0
  72. package/skills/ti-synthengine/assets/index.d.ts +122 -2
  73. package/skills/ti-synthengine/references/advanced-examples.md +4 -4
  74. package/skills/ti-synthengine/references/api.md +40 -18
  75. package/skills/ti-synthengine/references/audio-engine.md +15 -57
  76. package/skills/ti-synthengine/references/examples.md +63 -6
  77. package/skills/ti-synthengine/references/guide.md +61 -57
  78. package/skills/ti-synthengine/references/instruments-and-effects.md +15 -15
  79. package/skills/ti-synthengine/references/native-variation.md +53 -14
  80. package/skills/ti-synthengine/references/recipes-interaction.md +25 -20
  81. package/skills/ti-synthengine/references/recipes.md +19 -16
  82. package/skills/ti-synthengine/references/recommendations.md +12 -12
  83. package/skills/ti-synthengine/references/sound-api.md +197 -0
  84. package/skills/ti-synthengine/references/sound-design.md +7 -7
  85. package/skills/ti-synthengine/references/source-notes.md +62 -172
  86. package/skills/ti-synthengine/references/troubleshooting.md +17 -19
  87. package/skills/ti-synthengine/references/upgrade-2.0.0.md +40 -0
  88. package/skills/ti-ui/SKILL.md +28 -143
  89. package/skills/ti-ui/references/icons-and-splash-screens.md +74 -403
  90. package/skills/ti-ui/references/layouts-and-positioning.md +175 -402
  91. package/skills/ti-ui/references/listviews-and-performance.md +100 -703
  92. package/skills/ti-ui/references/platform-conventions.md +180 -0
  93. package/skills/ti-ui/references/user-interface.md +43 -0
  94. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
  95. package/skills/alloy-howtos/references/custom_tags.md +0 -148
  96. package/skills/ti-guides/references/coding-best-practices.md +0 -149
  97. package/skills/ti-guides/references/javascript-primer.md +0 -414
  98. package/skills/ti-guides/references/reserved-words.md +0 -36
  99. package/skills/ti-guides/references/style-and-conventions.md +0 -103
  100. package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -624
  101. package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
  102. package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
  103. package/skills/ti-howtos/references/google-maps-v2.md +0 -172
  104. package/skills/ti-howtos/references/ios-map-kit.md +0 -149
  105. package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -611
  106. package/skills/ti-howtos/references/tutorials.md +0 -565
  107. package/skills/ti-howtos/references/web-content-integration.md +0 -287
  108. package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -124
  109. package/skills/ti-synthengine/references/android-sim80-correction-evidence.zip +0 -0
  110. package/skills/ti-synthengine/references/android-sim80-correction.json +0 -162
  111. package/skills/ti-synthengine/references/audio-pipeline-validation.md +0 -19
  112. package/skills/ti-synthengine/references/bypass-physical-recheck-evidence.zip +0 -0
  113. package/skills/ti-synthengine/references/frontier-android-evidence.zip +0 -0
  114. package/skills/ti-synthengine/references/frontier-ipad-evidence.zip +0 -0
  115. package/skills/ti-synthengine/references/frontier-physical-validation.json +0 -1918
  116. package/skills/ti-synthengine/references/native-tone-repetition-validation.md +0 -59
  117. package/skills/ti-synthengine/references/native-variation-proposal.md +0 -182
  118. package/skills/ti-synthengine/references/native-variation-validation.md +0 -63
  119. package/skills/ti-synthengine/references/performance-review-evidence.zip +0 -0
  120. package/skills/ti-synthengine/references/performance-review.json +0 -1146
  121. package/skills/ti-synthengine/references/physical-validation.json +0 -1457
  122. package/skills/ti-synthengine/references/source-snapshot.json +0 -542
  123. package/skills/ti-synthengine/references/stats-performance.json +0 -2992
  124. package/skills/ti-synthengine/references/stats-performance.md +0 -82
  125. package/skills/ti-synthengine/references/studio-validation.json +0 -6202
  126. package/skills/ti-synthengine/references/unified-bypass-performance.json +0 -22425
  127. package/skills/ti-synthengine/references/unified-validation.json +0 -314
  128. package/skills/ti-ui/references/accessibility-deep-dive.md +0 -288
  129. package/skills/ti-ui/references/animation-and-matrices.md +0 -569
  130. package/skills/ti-ui/references/application-structures.md +0 -626
  131. package/skills/ti-ui/references/custom-fonts-styling.md +0 -549
  132. package/skills/ti-ui/references/event-handling.md +0 -401
  133. package/skills/ti-ui/references/gestures.md +0 -448
  134. package/skills/ti-ui/references/orientation.md +0 -374
  135. package/skills/ti-ui/references/platform-ui-android.md +0 -727
  136. package/skills/ti-ui/references/platform-ui-ios.md +0 -576
  137. package/skills/ti-ui/references/scrolling-views.md +0 -288
  138. package/skills/ti-ui/references/tableviews.md +0 -542
@@ -1,414 +0,0 @@
1
- # JavaScript development primer
2
-
3
- Essential JavaScript concepts, resources, and best practices for Titanium development.
4
-
5
- <!-- TOC-START -->
6
- ## Contents
7
-
8
- - [JavaScript overview](#javascript-overview)
9
- - [Learning resources](#learning-resources)
10
- - [Best practices](#best-practices)
11
- - [Common patterns](#common-patterns)
12
- - [ES6+ features in Titanium](#es6-features-in-titanium)
13
- - [Gotchas to avoid](#gotchas-to-avoid)
14
-
15
- <!-- TOC-END -->
16
-
17
- ## JavaScript overview
18
-
19
- JavaScript is the language of Titanium. It is lightweight and dynamic, with object-oriented and functional features.
20
-
21
- Why JavaScript for Titanium?
22
- - Widely deployed (every web browser)
23
- - Large community
24
- - Dynamic typing with duck typing
25
- - Functional programming support
26
- - Convenient object literal notation
27
- - Closures for encapsulation
28
- - Small learning curve
29
-
30
- JavaScript in Titanium:
31
- - No DOM manipulation (that is web-specific)
32
- - Access to native APIs via the Titanium namespace
33
- - ECMAScript 5/6 compliant
34
- - Same JavaScript you use on the web, but targeting mobile apps
35
-
36
- ---
37
-
38
- ## Learning resources
39
-
40
- ### Online courses
41
-
42
- - Codecademy: https://www.codecademy.com/learn/introduction-to-javascript
43
- - Stanford CS101: http://www.stanford.edu/class/cs101/
44
- - edX: https://www.edx.org/learn/javascript
45
-
46
- ### Online books and references
47
-
48
- - Eloquent JavaScript: https://eloquentjavascript.net/
49
- - MDN JavaScript Guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
50
- - Douglas Crockford's resources: http://javascript.crockford.com/
51
- - JavaScript in 10 Minutes: https://github.com/spencertipping/js-in-ten-minutes
52
- - Google JavaScript Style Guide: https://google.github.io/styleguide/jsguide.html
53
- - Learning Advanced JavaScript: http://ejohn.org/apps/learn/
54
-
55
- ### Print books (recommended)
56
-
57
- - JavaScript: The Good Parts (Douglas Crockford)
58
- - JavaScript: The Definitive Guide (David Flanagan)
59
- - JavaScript Patterns (Stoyan Stefanov)
60
- - Eloquent JavaScript (Marijn Haverbeke)
61
-
62
- ---
63
-
64
- ## Best practices
65
-
66
- ### Do not pollute the global scope
67
-
68
- Bad: everything in global scope
69
- ```javascript
70
- const key = 'value';
71
- const foo = 'bar';
72
-
73
- function helper() {
74
- // help out
75
- }
76
-
77
- function info(msg) {
78
- helper(msg);
79
- Ti.API.info(msg);
80
- }
81
- ```
82
-
83
- Good: single namespace
84
- ```javascript
85
- const myapp = {}; // Only one global variable
86
-
87
- myapp.key = 'value';
88
-
89
- myapp.dosomething = (foo) => {
90
- // do something
91
- };
92
-
93
- // Self-closing function for private members
94
- (() => {
95
- function helper() {
96
- // Private - not accessible globally
97
- }
98
-
99
- myapp.info = (msg) => {
100
- helper(msg);
101
- Ti.API.info(msg);
102
- };
103
- })();
104
-
105
- myapp.info('Hello World');
106
- ```
107
-
108
- ### Use strict equality
109
-
110
- Bad: `==` converts types
111
- ```javascript
112
- const testme = '1';
113
- if (testme == 1) {
114
- // Executes! '1' is converted to integer
115
- }
116
- ```
117
-
118
- Good: `===` checks both type and value
119
- ```javascript
120
- const testme = '1';
121
- if (testme === 1) {
122
- // Does NOT execute
123
- }
124
- ```
125
-
126
- ### Efficient loops
127
-
128
- Bad: checks `array.length` every iteration
129
- ```javascript
130
- const names = ['Jeff', 'Nolan', 'Marshall', 'Don'];
131
- for (let i = 0; i < names.length; i++) {
132
- process(names[i]);
133
- }
134
- ```
135
-
136
- Good: cache length
137
- ```javascript
138
- const names = ['Jeff', 'Nolan', 'Marshall', 'Don'];
139
- for (let i = 0, j = names.length; i < j; i++) {
140
- process(names[i]);
141
- }
142
- ```
143
-
144
- This is especially important with Titanium proxy objects, where checking length on each iteration has extra overhead.
145
-
146
- Even better: ES6 `for...of`
147
- ```javascript
148
- for (const name of names) {
149
- process(name);
150
- }
151
- ```
152
-
153
- ### Prefer `const` and `let` over `var`
154
-
155
- `var` is function-scoped and hoisted; `let` and `const` are block-scoped and clearer.
156
-
157
- ```javascript
158
- // Avoid: var (function-scoped, can be accidentally hoisted)
159
- var x = 10;
160
-
161
- // Prefer: const for values that do not change
162
- const MAX_RETRIES = 3;
163
- const config = { timeout: 5000 };
164
-
165
- // Use let only when the binding must be reassigned
166
- let retryCount = 0;
167
- retryCount++;
168
- ```
169
-
170
- Rule of thumb: reach for `const` first; switch to `let` only when you need to reassign; never use `var` in new code.
171
-
172
- ---
173
-
174
- ## Common patterns
175
-
176
- ### Ternary operator
177
-
178
- Compact conditional assignment. Value after `?` is used if the condition is true; value after `:` if false.
179
-
180
- ```javascript
181
- // Instead of this:
182
- let xyz;
183
- if (somecondition === somevalue) {
184
- xyz = 'abc';
185
- } else {
186
- xyz = '123';
187
- }
188
-
189
- // Use this:
190
- const xyz = (somecondition === somevalue) ? 'abc' : '123';
191
- ```
192
-
193
- ### Multiple variable declarations
194
-
195
- Use commas instead of multiple `var` statements:
196
-
197
- ```javascript
198
- // Instead of this:
199
- const foo = true;
200
- const me = 'awesome';
201
- const great = 42;
202
-
203
- // Use this:
204
- const foo = true,
205
- me = 'awesome',
206
- great = 42;
207
- ```
208
-
209
- ### Self-calling functions (IIFE)
210
-
211
- Encapsulate private variables and functions:
212
-
213
- Ambiguous (not recommended):
214
- ```javascript
215
- const myValue = (() => {
216
- return someValue;
217
- })(); // Looks like assigning function, not result
218
- ```
219
-
220
- Clear (recommended):
221
- ```javascript
222
- const myValue = (() => {
223
- // Private variables here
224
- const privateVar = 'secret';
225
-
226
- return someValue;
227
- })(); // Clearly returns result, not function
228
- ```
229
-
230
- ### CommonJS modules
231
-
232
- Use `require()` for modular code:
233
-
234
- myModule.js:
235
- ```javascript
236
- // Private
237
- const privateData = 'secret';
238
-
239
- function privateHelper() {
240
- // Private function
241
- }
242
-
243
- // Public API
244
- exports.publicMethod = () => {
245
- privateHelper();
246
- return privateData;
247
- };
248
- ```
249
-
250
- app.js:
251
- ```javascript
252
- const myModule = require('myModule');
253
- myModule.publicMethod();
254
- ```
255
-
256
- ---
257
-
258
- ## ES6+ features in Titanium
259
-
260
- Titanium supports modern JavaScript (ES6/ES7+). Use these features.
261
-
262
- Arrow functions:
263
- ```javascript
264
- // Old
265
- const self = this;
266
- someArray.forEach(function(item) {
267
- self.process(item);
268
- });
269
-
270
- // New (arrow function preserves 'this')
271
- someArray.forEach((item) => {
272
- this.process(item);
273
- });
274
- ```
275
-
276
- Template literals:
277
- ```javascript
278
- // Old
279
- const message = 'Hello ' + name + ', you have ' + count + ' messages';
280
-
281
- // New
282
- const message = `Hello ${name}, you have ${count} messages`;
283
- ```
284
-
285
- Destructuring:
286
- ```javascript
287
- // Old
288
- const width = e.source.size.width;
289
- const height = e.source.size.height;
290
-
291
- // New
292
- const {width, height} = e.source.size;
293
- ```
294
-
295
- Spread operator:
296
- ```javascript
297
- // Old
298
- const arr = [1, 2, 3];
299
- const arr2 = arr.concat([4, 5]);
300
-
301
- // New
302
- const arr2 = [...arr, 4, 5];
303
- ```
304
-
305
- Classes:
306
- ```javascript
307
- class Person {
308
- constructor(name) {
309
- this.name = name;
310
- }
311
-
312
- greet() {
313
- return `Hello, I'm ${this.name}`;
314
- }
315
- }
316
- ```
317
-
318
- ---
319
-
320
- ## Gotchas to avoid
321
-
322
- ### Variable hoisting
323
-
324
- Problem: variables are hoisted to function scope.
325
- ```javascript
326
- function test() {
327
- console.log(myVar); // undefined (not error)
328
- var myVar = 'value';
329
- }
330
- ```
331
-
332
- Solution: declare variables at the top of the function.
333
- ```javascript
334
- function test() {
335
- let myVar; // Declare first
336
- console.log(myVar);
337
- myVar = 'value';
338
- }
339
- ```
340
-
341
- ### Global variable accidents
342
-
343
- Problem: forgetting `var` creates a global variable.
344
- ```javascript
345
- function test() {
346
- myVar = 'value'; // Creates a global variable
347
- }
348
- ```
349
-
350
- Solution: always use `var`, `let`, or `const`.
351
- ```javascript
352
- function test() {
353
- const myVar = 'value';
354
- }
355
- ```
356
-
357
- ### The `this` context
358
-
359
- Problem: `this` changes in different contexts.
360
- ```javascript
361
- const obj = {
362
- value: 42,
363
- getValue: function() {
364
- setTimeout(function() {
365
- console.log(this.value); // undefined
366
- }, 100);
367
- }
368
- };
369
- ```
370
-
371
- Solution 1: store `this`.
372
- ```javascript
373
- const obj = {
374
- value: 42,
375
- getValue: function() {
376
- const self = this;
377
- setTimeout(function() {
378
- console.log(self.value); // Works
379
- }, 100);
380
- }
381
- };
382
- ```
383
-
384
- Solution 2: arrow function (ES6).
385
- ```javascript
386
- const obj = {
387
- value: 42,
388
- getValue() {
389
- setTimeout(() => {
390
- console.log(this.value); // Works
391
- }, 100);
392
- }
393
- };
394
- ```
395
-
396
- ### Semicolon insertion
397
-
398
- JavaScript automatically inserts semicolons and can cause bugs.
399
-
400
- Dangerous:
401
- ```javascript
402
- return
403
- {
404
- name: 'Test'
405
- };
406
- // Returns undefined
407
- ```
408
-
409
- Safe:
410
- ```javascript
411
- return {
412
- name: 'Test'
413
- };
414
- ```
@@ -1,36 +0,0 @@
1
- # Reserved words in Titanium
2
-
3
- ## ECMAScript reserved keywords
4
-
5
- These keywords cannot be used as variable, function, method, or object identifiers under the ECMAScript specification:
6
-
7
- ```
8
- abstract, boolean, break, byte, case, catch, char, class, const, continue,
9
- debugger, default, delete, do, double, else, enum, export, extends, finally,
10
- for, function, goto, if, implements, import, in, instanceof, int, interface,
11
- let, long, native, new, package, private, protected, public, return, short,
12
- static, super, switch, synchronized, this, throw, throws, transient, try,
13
- typeof, var, void, volatile, while, with, yield
14
- ```
15
-
16
- ## iOS Objective-C reserved words
17
-
18
- These keywords are exposed from Objective-C and should not be used as identifiers on iOS:
19
-
20
- ```
21
- _configure, _destroy, _initProperties, autorelease, deadlock, dealloc,
22
- description, id, init, release, startup
23
- ```
24
-
25
- ## Alloy reserved words
26
-
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
-
29
- ## Best practice
30
-
31
- Avoid these reserved words when naming:
32
- - Variables
33
- - Functions
34
- - Methods
35
- - Object properties
36
- - Module exports
@@ -1,103 +0,0 @@
1
- # Style and conventions reference
2
-
3
- ## 1. Naming conventions
4
-
5
- - Variables: `nounCategory` (for example, `personName`, `buttonSubmit`).
6
- - Functions: `verbCategory` (for example, `getPersonName`, `doSync`).
7
- - Classes/constructors: `PascalCase` (for example, `User`, `NetClient`).
8
- - Factories: prefix with `create` (for example, `createWidget`).
9
- - Namespaces: use capitalized words (for example, `App.UI.Widget`, `App.Network.Request`). Avoid lowercase for major namespaces (use `App.UI`, not `app.ui`).
10
- - Hungarian notation: not supported by the Titanium SDK.
11
-
12
- ## 2. Language rules
13
-
14
- - Semicolons: official SDK guides require semicolons, but the `ti-expert` standard omits them and lets ASI handle it.
15
- - `this` keyword: use with care. It may not refer to the object you expect.
16
-
17
- ## 3. Formatting
18
-
19
- - Indentation: both K&R/1TBS and Allman styles are acceptable. Consistency matters. Do not mix styles in the same project.
20
- ```javascript
21
- // K&R/1TBS style
22
- if (x < 10) {
23
- if (y > 10) {
24
- // do this
25
- }
26
- } else {
27
- // do this
28
- }
29
- ```
30
- ```javascript
31
- // Allman style
32
- if (x < 10)
33
- {
34
- if (y > 10)
35
- {
36
- // do this
37
- }
38
- }
39
- else
40
- {
41
- // do this
42
- }
43
- ```
44
- - Operators: add a single space around operators.
45
- ```javascript
46
- const fullName = firstName + ' ' + lastName
47
- ```
48
-
49
- Return statement placement: Do not put `return` on its own line followed by an object literal. JavaScript will insert a semicolon automatically and return `undefined`.
50
- ```javascript
51
- // Wrong
52
- return
53
- {
54
- foo: 'bar'
55
- }
56
-
57
- // Correct
58
- return {
59
- foo: 'bar'
60
- }
61
- ```
62
-
63
- ## 4. Control statements
64
-
65
- Switch statements should have a single space before the opening parenthesis and a single space after the closing parenthesis. Switch content is indented with one tab; content in each case is indented one tab as well.
66
- ```javascript
67
- switch (someTest) {
68
- case 1:
69
- break;
70
-
71
- case 2:
72
- break;
73
-
74
- default:
75
- break;
76
- }
77
- ```
78
-
79
- ## 5. Primitive types
80
-
81
- - Avoid using primitive type object constructors (for example, `new String()`).
82
- - Use template literals or single-space concatenation.
83
-
84
- ## 6. Comments and documentation
85
-
86
- - Single-line comments: required to reduce programmer error. Inline statement comments should be used at a minimum or not at all.
87
- - JSDoc/block comments: required for documenting functions and classes.
88
- ```javascript
89
- // Calculate position using initial
90
- // and offset x coordinates.
91
- const finalPos = initPosX + offsetPosX;
92
-
93
- /**
94
- * @param {String} customerName Customer's full name.
95
- */
96
- function getCustomer(customerName) {}
97
- ```
98
-
99
- ## 7. References
100
-
101
- - Douglas Crockford's JavaScript Code Conventions
102
- - Google's JavaScript Style Guide: https://google.github.io/styleguide/jsguide.html
103
- - TiDev ESLint Configuration (rules used for SDK-related npm packages and CLI code): https://github.com/tidev/eslint-config-axway