Skip to content

Commit

Permalink
Added simple debug option.
Browse files Browse the repository at this point in the history
In your browser, open the element inspector/console with ie. F12.

Then type `my.debug = true;` to turn on debug mode.

#25
  • Loading branch information
JelmerD committed Apr 8, 2021
1 parent 9ab743d commit abe13ae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var my = {
currentBeacon: undefined,
map: undefined,
plane: undefined,
simulationRate: 1
simulationRate: 1,
debug: false
};

var elem = {};
Expand Down Expand Up @@ -240,7 +241,7 @@ function Scene() {
function bindKeys() {
// keys that can be hold down
$(document).on('keydown', function (e) {
//debug('keyDown: ' + e.keyCode);
debug('keyDown: ' + e.keyCode);
if (keyDown[keyMap[e.keyCode]] != undefined) {
keyDown[keyMap[e.keyCode]](e);
}
Expand Down Expand Up @@ -660,5 +661,7 @@ function calcHeadingDiff(a, b) {
* @param data
*/
function debug(data) {
console.log(data);
if (my.debug) {
console.log(data);
}
}

0 comments on commit abe13ae

Please sign in to comment.