processing / p5.js-editor

Deprecated desktop editor for p5.js
https://p5js.org
MIT License
338 stars 91 forks source link

Integration with different browsers. #196

Closed knotech closed 8 years ago

knotech commented 8 years ago

I'm digging through the source, and pretty new at this, and the whole open-source thing. So I'm not sure how to ask these questions about enhancements. If I'm doing this wrong please let me know.

How much of a stretch, effort do you think it would be create an option to open a sketch in a different browser, chrome, firefox, etc., from the editor, as I'm realizing a lot of straight JS stuff I'm trying to add doesn't work the same or at all, specifically nesting functions on arrays, as it does in the browser.

my big problem was with shifting arrays in a for loop, though my initial approach worked in the node command line, and in chrome & firefox.

var tmp; var someArray = ['array', 'full', 'of', 'values']; var destinationArray = []; /**

array.unshift() and array.shift() came up undefined was the big deal.

// Resorted to: tmp = someArray.slice(1,someArray.length) tmp.push(someArray[0]] // This worked

Maybe it's a fundamental misunderstanding of nesting functions/namespace considerations in JS on my part. Wouldn't be the first, or the last.

I guess I'm also wondering what JS engine the browser window is using, cause I seem to be throwing errors a lot when I'm trying to write some straight JS.

Sorry if this is too much question, I'm newer to JS, and in the 4 years I've been serious hobbyist about it, I haven't ever really talked to anyone about programming before who wasn't completely condescending, but this seems like the community to start.

Constructive criticism about how to structure these questions in a manner that is easiest on you the maintainer, as I understand you have real, nasty bugs to work on, and/or pointing me in the directions to look for answers, guides for how to discuss/code with other people, etc.. would be super appreciated. You know, teach a dude to fish.

Thanks.

knotech commented 8 years ago

I've realized I'm far enough into this that I have boilerplate for projects that run on the web, and that this is an introductory thing. Extending the editor to open sketches in other browsers is almost silly, increases the scope beyond it's intention, would possibly detract from the purpose of helping getting started with p5 as easily as possible. Not to mention introduce whole other sets of problems, i.e. accounting for different browser conventions for implementations, or lack thereof for every standard... Blah blah blah. browsers. When there are real bugs here.

Though I figured out that the array.unshift() and array.shift() methods aren't in the P5.Array.prototype set.

https://github.com/processing/p5.js/blob/master/src/utilities/array_functions.js

Would this be worth checking with the p5.js maintainers or are there any issues here, that I might be able to try my hand at? Should I just pick one up and try to fix it? is that how this works?

lmccart commented 8 years ago

hi @knotech it is already possible to open a sketch in your own web browser by clicking on the settings icon and selecting "run in browser". does this accomplish what you are trying to do? or maybe i am misunderstanding.

knotech commented 8 years ago

HA! Thank you! totally.

lmccart commented 8 years ago

:)

knotech commented 8 years ago

Thanks I think stack overflow ruined me for participating in this stuff. You totally just fixed that. :)