Skip to content

print() function, even with content, causes print dialog to appear in… #4324

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

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
11 changes: 4 additions & 7 deletions src/core/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ p5.prototype._frameRate = 0;
p5.prototype._lastFrameTime = window.performance.now();
p5.prototype._targetFrameRate = 60;

const _windowPrint = window.print;
// const _windowPrint = window.print;

/**
* The <a href="#/p5/print">print()</a> function writes to the console area of your browser.
* This function is often helpful for looking at the data a program is
* producing. This function creates a new line of text for each call to
* the function. Individual elements can be
* separated with quotes ("") and joined with the addition operator (+).
*
* Note that calling print() without any arguments invokes the window.print()
* function which opens the browser's print dialog. To print a blank line
* to console you can write print('\n').
*
* @method print
* @param {Any} contents any combination of Number, String, Object, Boolean,
* Array to print
Expand All @@ -40,9 +35,11 @@ const _windowPrint = window.print;
* @alt
* default grey canvas
*/

p5.prototype.print = function(...args) {
if (!args.length) {
_windowPrint();
// _windowPrint();
console.log('\n');
} else {
console.log(...args);
}
Expand Down