File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1156
1156
* `loadImage()`, `loadJSON()`, `loadSound()`, and so on. This allows you to:
1157
1157
* - load files in a more readable, top-to-bottom manner
1158
1158
* - decide when the assets are fully available before proceeding
1159
- * - avoid nested callbacks often referred to as "callback hell"
1159
+ *
1160
+ * Nested callbacks require managing additional information and behavior.
1161
+ * Lazy loading of assets with `async/await` can simplify control flow,
1162
+ * but it also requires you to design your sketch around waiting for
1163
+ * each operation to complete.
1164
+ *
1165
+ * Callbacks are still fully supported, so code that passes success / error
1166
+ * functions to loaders like `loadImage()` or `loadJSON()` will behave exactly
1167
+ * as it always has. This compatibility means sketches written with the older
1168
+ * pattern don’t need any changes, and you can freely mix callbacks and
1169
+ * `async/await` in the same project if that suits your workflow.
1160
1170
*
1161
1171
* In the example below, `setup()` is declared as an async function. We `await`
1162
1172
* the completion of both `loadImage()` and `loadJSON()` before calling
You can’t perform that action at this time.
0 commit comments