You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #1130 we added some logic that attempts to notice when people use p5's global APIs in top-level code, but it looks like there are some ways to improve it:
Based on createGraphics() undefined #1237 it looks like we might want to detect if createGraphics was called. Perhaps also the other p5 methods that start with create, e.g. createCanvas?
Based on PI is not defined before setup()! #903 it looks like folks will (understandably) expect P5's global constants to be defined during page load, so detecting for those would be good too.
Another possibility for the first two is to actually embed an entire (auto-generated) list of every single public p5 symbol in the debug builds of p5.js, and match any pre-load exceptions thrown to it. This might have the downside of matching on too many exceptions, but it's also much more likely to help beginners... Hmm.
The text was updated successfully, but these errors were encountered:
toolness
changed the title
Add more help for global APIs used at top-level code
Add more friendly error help for global APIs used at top-level code
Feb 11, 2016
In #1130 we added some logic that attempts to notice when people use p5's global APIs in top-level code, but it looks like there are some ways to improve it:
createGraphics
was called. Perhaps also the other p5 methods that start withcreate
, e.g.createCanvas
?Another possibility for the first two is to actually embed an entire (auto-generated) list of every single public p5 symbol in the debug builds of p5.js, and match any pre-load exceptions thrown to it. This might have the downside of matching on too many exceptions, but it's also much more likely to help beginners... Hmm.
The text was updated successfully, but these errors were encountered: