Skip to content

Commit f23a33e

Browse files
committed
tweaking save() documentation
1 parent de0dbf1 commit f23a33e

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

src/output/files.js

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,34 +111,46 @@ define(function (require) {
111111
* the client's computer.<br/>
112112
* <br/>
113113
* The default behavior is to save an image from the canvas. For example:
114-
* <br/>
114+
* <br/><br/>
115115
* <code>save()</code><br/>
116-
* <code>save('myFile.jpg')</code><br/>
117-
* <code>save('myFile', 'jpeg')</code><br/><br/>
116+
* <code>save('myFile.jpg')</code><br/><br/>
118117
*
119118
* Alternately, the first parameter can be an Array of Strings,
120119
* an Array of JSON, a JSON object, a p5.Table, a p5.Image, or a
121120
* p5.SoundFile (requires p5.sound). The second parameter is a filename
122121
* (including extension). The third parameter is for options specific
123122
* to this type of object. This method will save a file that fits the
124123
* given paramaters. For example: <br/><br/>
125-
* <code>save(myTable, 'myTable.html')</code> saves table as html file<br/>
126-
* <code>save(myTable, 'myTable.csv',)</code> comma separated values<br/>
127-
* <code>save(myTable, 'myTable.tsv')</code> tab separated values<br/>
124+
* <code>save(myTable, 'myTable.html')</code> Saves table as html file<br/>
125+
* <code>save(myTable, 'myTable.csv',)</code> Comma Separated Values<br/>
126+
* <code>save(myTable, 'myTable.tsv')</code> Tab Separated Values<br/>
128127
* <br/>
129-
* <code>save(myJSON, 'my.json')</code>saves pretty JSON<br/>
130-
* <code>save(myJSON, 'my.json', true)</code>optimizes JSON filesize<br/>
128+
* <code>save(myJSON, 'my.json')</code> Saves pretty JSON<br/>
129+
* <code>save(myJSON, 'my.json', true)</code> Optimizes JSON filesize<br/>
131130
* <br/>
132-
* <code>save(img, 'my.png')</code> saves pImage as a png image<br/>
131+
* <code>save(img, 'my.png')</code> Saves pImage as a png image<br/>
133132
* <br/>
134-
* <code>save(arrayOfStrings, 'my.txt')</code>saves strings to a
133+
* <code>save(arrayOfStrings, 'my.txt')</code> Saves strings to a
135134
* text file with line breaks after each item in the array<br/>
136135
*
137136
* @method save
138-
* @param {[type]} object [description]
139-
* @param {[type]} _filename [description]
140-
* @param {[type]} _options [description]
141-
* @return {[type]} [description]
137+
* @param {[Object/String]} object/filename If filename is provided, will
138+
* save canvas as an image with
139+
* either png or jpg extension
140+
* depending on the filename.
141+
* If object is provided, will
142+
* save depending on the object
143+
* and filename (see examples
144+
* above).
145+
* @param {[String]} filename If an object is provided as the first
146+
* parameter, then the second parameter
147+
* indicates the filename,
148+
* and should include an appropriate
149+
* file extension (see examples above).
150+
* @param {[Boolean]} options Additional options depend on filetype. For
151+
* example, when saving JSON, true indicates that
152+
* the output will be optimized for filesize,
153+
* rather than readability.
142154
*/
143155
p5.prototype.save = function(object, _filename, _options) {
144156
// parse the arguments and figure out which things we are saving

0 commit comments

Comments
 (0)