Closed toolness closed 8 years ago
@toolness Awesome! I'm still wrapping my head around the concept and syntax here, but I get that this lets us call p5 global mode after we're sure everything else has loaded. Seems more elegant than a bunch of iframes too. I'll stay tuned for the response to processing/p5.js#1570 :)
This adds foundational support for loading multiple libraries which depend on p5.js in
preview-frame.ts
. It effectively implements option 3 described in https://github.com/toolness/p5.js-widget/issues/53#issuecomment-240387563.The biggest volatility here is that it uses an undocumented feature of the
p5
constructor whereby if asketch
function isn't passed in as the first argument, p5 will initialize itself in global mode. If we can make this a documented, supported use case in p5 core, that will ensure the widget continues to work as p5 matures. I've filed https://github.com/processing/p5.js/issues/1570 for this.Thoughts @kaganjd ?