From 0336891d8e7589b9f66093faeedc626e5dd2ca3a Mon Sep 17 00:00:00 2001 From: JATIN <Jatin04072005@gmail.com> Date: Sat, 15 Feb 2025 20:17:59 +0530 Subject: [PATCH] Fix Load Function to Accept a callback without triggering a warning --- src/core/friendly_errors/validate_params.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/friendly_errors/validate_params.js b/src/core/friendly_errors/validate_params.js index bf98dca98b..c5f0935003 100644 --- a/src/core/friendly_errors/validate_params.js +++ b/src/core/friendly_errors/validate_params.js @@ -722,6 +722,10 @@ if (typeof IS_MINIFIED !== 'undefined') { let argCount = args.length; + // Allow loadFont() to accept a callback without triggering a warning + if (func === 'loadFont' && argCount === 2 && typeof args[1] === 'function') { + return; + } // the following line ignores trailing undefined arguments, commenting // it to resolve https://github.com/processing/p5.js/issues/4571 // '== null' checks for 'null' and typeof 'undefined'