@@ -273,14 +273,15 @@ function structure(p5, fn){
273273 * second. Calling <a href="#/p5/noLoop">noLoop()</a> stops
274274 * <a href="#/p5/draw">draw()</a> from repeating. Calling `redraw()` will
275275 * execute the code in the <a href="#/p5/draw">draw()</a> function a set
276- * number of times.
276+ * number of times. `await` the result of `redraw` to make sure it has finished.
277277 *
278278 * The parameter, `n`, is optional. If a number is passed, as in `redraw(5)`,
279279 * then the draw loop will run the given number of times. By default, `n` is
280280 * 1.
281281 *
282282 * @method redraw
283283 * @param {Integer } [n] number of times to run <a href="#/p5/draw">draw()</a>. Defaults to 1.
284+ * @returns {Promise<void> }
284285 *
285286 * @example
286287 * <div>
@@ -311,8 +312,8 @@ function structure(p5, fn){
311312 * }
312313 *
313314 * // Run the draw loop when the user double-clicks.
314- * function doubleClicked() {
315- * redraw();
315+ * async function doubleClicked() {
316+ * await redraw();
316317 * }
317318 * </code>
318319 * </div>
@@ -345,8 +346,8 @@ function structure(p5, fn){
345346 * }
346347 *
347348 * // Run the draw loop three times when the user double-clicks.
348- * function doubleClicked() {
349- * redraw(3);
349+ * async function doubleClicked() {
350+ * await redraw(3);
350351 * }
351352 * </code>
352353 * </div>
@@ -583,4 +584,4 @@ export default structure;
583584
584585if ( typeof p5 !== 'undefined' ) {
585586 structure ( p5 , p5 . prototype ) ;
586- }
587+ }
0 commit comments