8000 Adds examples in README.rst · pyodide/sphinx-js@0360bdf · GitHub
[go: up one dir, main page]

Skip to content

Commit 0360bdf

Browse files
committed
Adds examples in README.rst
1 parent 3df49d6 commit 0360bdf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,32 @@ optional parameters::
9898

9999
.. js:autofunction:: someFunction(foo, bar[, baz])
100100

101+
Parametter's properties and destructuring parameters can also be documented::
102+
103+
/**
104+
* Export an image from the given canvas and save it to the disk.
105+
*
106+
* @param {string} filename The name of the output file.
107+
* @param {Object} options Output options.
108+
* @param {string} options.format The output format (``jpeg``, ``png`` or ``webp``).
109+
* @param {number} options.quality The output quality when format is ``jpeg`` or ``webp`` (from ``0.00`` to ``1.00``).
110+
*/
111+
function saveCanvas(filename, options) {
112+
// ...
113+
}
114+
115+
/**
116+
* Export an image from the given canvas and save it to the disk.
117+
*
118+
* @param {string} filename The name of the output file.
119+
* @param {Object} options Output options.
120+
* @param {string} options.format The output format (``jpeg``, ``png`` or ``webp``).
121+
* @param {number} options.quality The output quality when format is ``jpeg`` or ``webp`` (from ``0.00`` to ``1.00``).
122+
*/
123+
function saveCanvas(filename, { format, quality }) {
124+
// ...
125+
}
126+
101127
You can even add additional content. If you do, it will appear just below any extracted documentation::
102128

103129
.. js:autofunction:: someFunction

0 commit comments

Comments
 (0)
0