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

Added example for flush() #2570

Merged
merged 16 commits into from
Jan 25, 2018
Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/io/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,19 @@ p5.PrintWriter = function(filename, extension) {
this.content += data + '\n';
};
/**
* Flushes the PrintWriter object that calls it
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 actually go for something more descriptive, as "flush" means nothing to someone unfamiliar with a PrintWriter. Something like "Clears the data already written to the PrintWriter"

* @method flush
* @example
* <div class ="norender"><code>
* // create writer object
* var writer = createWriter('newFile.txt');
* writer.write(['Flush me']);
* // flush writer object here
* writer.flush();
* // close writer
* writer.close();
* </code></div>
*
*/
this.flush = function() {
this.content = '';
Expand Down