preload() asset readiness consistency across p5.js deployment targets
28K reputation · 27 Oct 2025, 08:38 UTC
This question addresses whether p5.js preload() uniformly ensures that referenced assets are fully available before setup() begins execution, regardless of the deployment target. The documented feature specifies that preload() runs asynchronously and must complete before the sketch lifecycle proceeds to setup(), but practical guarantees vary across environments.
Different p5.js release lines may handle preload() sequencing differently, and the project documentation does not provide a cross-version compatibility matrix for this lifecycle step. Additionally, deployment context—such as whether a sketch runs from the Web Editor, an npm bundle, or a local file URL—can introduce variables that affect when assets are resolved relative to setup() execution.
Does preload() wait for all asset types (images, fonts, sounds) before invoking setup()? Are there edge cases where setup() proceeds with partially loaded assets? What impact do content security policies in hosted environments have on preload() asset resolution?