Skip to content

Gate togglebutton.js console.log behind togglebuttonDebug - #78

Open
BetterAndBetterII wants to merge 1 commit into
executablebooks:masterfrom
BetterAndBetterII:fix/console-log-debug
Open

Gate togglebutton.js console.log behind togglebuttonDebug#78
BetterAndBetterII wants to merge 1 commit into
executablebooks:masterfrom
BetterAndBetterII:fix/console-log-debug

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

initToggleItems always called console.log with the count of toggled items on every page load, which cluttered the browser console (#56). Two other leftover console.log calls in the same file had the same problem.

Route those messages through a small togglebuttonLog helper that only writes when togglebuttonDebug is set. Default behavior is silent; set togglebuttonDebug = true before the script runs to restore the previous messages.

Test

node --test tests/test_togglebutton_console.js

Fixes #56

Unconditional console.log in initToggleItems cluttered the browser
console on every page load. Route leftover logs through a helper that
only writes when togglebuttonDebug is set.

Fixes executablebooks#56
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.

togglebutton.js shouldn't log to the console unconditionally

1 participant