# Help extending p5 and dependencies in web dev

**URL:** <https://discourse.processing.org/t/help-extending-p5-and-dependencies-in-web-dev/44421>\
**Category:** Coding Questions\
**Created:** [May 14, 2024, 12:34am UTC](https://discourse.processing.org/t/help-extending-p5-and-dependencies-in-web-dev/44421 "2024-05-14T00:34:58Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 14, 2024, 3:38pm UTC](https://discourse.processing.org/t/help-extending-p5-and-dependencies-in-web-dev/44421/13 "2024-05-14T15:38:06Z")

</div>

This is from an old code I did:

> [@Rosetta Examples development](https://discourse.processing.org/t/rosetta-examples-development/18945/72):
>
> Well, I did. But it took me more time. mantelpiece_clock I’ve based mine on the Go version (although I barely know anything about that Google language): woozy_face[RosettaCode.org/wiki/Sierpinski\_pentagon#Go](http://RosettaCode.org/wiki/Sierpinski_pentagon#Go) That version uses a fixed palette of 5 primary colors. paintbrush In my sketch conversion I keep track of the current palette's index by returning it at the end of the recursive pentagon() function. triangular_ruler In order to get a free color fill() I’m using beginDraw() + ve…

When I had to lookup how p5js decides to go “Global Mode” and then hack it:

> <https://github.com/processing/p5.js/blob/v1.9.3/src/core/init.js#L27-L38>

As you can notice, if we assign anything [“truthy”](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) to _mocha_, p5.js library will never auto-instantiate p5!

Well, unless we do it ourselves later. 😉

Same for _\_setupDone_, but for suppressing the annoying **warn()** message:

> <https://github.com/processing/p5.js/blob/v1.9.3/src/core/init.js#L16-L25>

---

_[View the full topic](https://discourse.processing.org/t/help-extending-p5-and-dependencies-in-web-dev/44421)._
