Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/httpPost #2163

Merged
merged 5 commits into from
Sep 15, 2017
Merged

docs/httpPost #2163

merged 5 commits into from
Sep 15, 2017

Conversation

austince
Copy link
Contributor

Working on documentation from this issue: #1954

Let me know if this format looks good and I'll keep doin' it!

@austince austince changed the title Docs/http post docs/httpPost Sep 12, 2017
* createCanvas(800, 800);
* }
*
* function mousePressed() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add a note about p5.dom ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This form of mousePressed is bundled with p5.js, only p5.Element.mousePressed is bundled with p5.dom.js so the user probably won't need p5.dom.js when running this example on their own.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool - new here. Thanks!

src/io/files.js Outdated
* <div><code>
* // Examples use jsonplaceholder.typicode.com for a Mock Data API
*
* var url = 'https://jsonplaceholder.typicode.com/posts';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this service doesn't have rate limiting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. Can't find any documentation and my own testing seems to agree

src/io/files.js Outdated
* ellipse(mouseX, mouseY, 200, 200);
* text(result.body, mouseX, mouseY);
* },
* function (error) {
Copy link
Member

@limzykenneth limzykenneth Sep 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the error callback can be omitted to show it's optional and I think it may only be used in some cases.

Edit: Since you already have example showing using the error callback, maybe omit them in this example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do!

src/io/files.js Outdated
* // Examples use jsonplaceholder.typicode.com for a Mock Data API
*
* var url = 'https://jsonplaceholder.typicode.com/posts';
* var post = { userId: 1, title: 'p5 Clicked!', body: 'p5.js is way cool.' };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer another name for the variable just so to not be confused with httpDo's "method" argument

src/io/files.js Outdated
* // ... won't be called
* },
* function (error) {
* console.error(error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove this console.error, the error callback should be a mechanism to catch error and not throw them. (Avoiding exception that will be thrown by default if no error callback is provided)

@limzykenneth
Copy link
Member

Thanks @austince! Overall just have a look at the line comments I left. Other than that, it would be nicer to have something that do more than just printing the returned data on screen but this serves as a good start.

@austince
Copy link
Contributor Author

austince commented Sep 12, 2017

Sounds good, I can get more creative with it, just wanted to get general feedback on the format before I got too deep.

src/io/files.js Outdated
* text(result.body, mouseX, mouseY);
* });
*
* // you can also omit the datatype and httpPost will guess
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can omit this block.. it's useful to know but makes the example look longer than it actually is. Maybe instead, we just add your note to the [datatype] param definition line above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lmccart
Copy link
Member

lmccart commented Sep 14, 2017

looks great! one small change then it's ready to merge.

@austince
Copy link
Contributor Author

Cool, thanks! 💯

@lmccart lmccart merged commit fd750bf into processing:master Sep 15, 2017
@lmccart
Copy link
Member

lmccart commented Sep 15, 2017

awesome thank you! 🎉

@austince austince deleted the docs/http-post branch January 31, 2018 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants