Skip to content

Commit

Permalink
added: log execution time if debugging option is set
Browse files Browse the repository at this point in the history
  • Loading branch information
8ctopus committed Aug 20, 2021
1 parent 786776a commit 9e89394
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions scapp.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

body:disabled {
filter: blur(1dip);
transition-duration: 400ms;
}

plaintext#logger {
Expand Down Expand Up @@ -97,6 +98,7 @@
case "options":
// options that apply to all dialogs
dialogs.setOptions({
debugging: true,
logging: true,
callback: dialogCallback,
css: [
Expand Down
10 changes: 7 additions & 3 deletions src/dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
try {
// shown
//console.debug(`after ready window state - ${Window.this.state}`);
const timer = new Date();

// get parameters
globalThis.params = Window.this.parameters;
Expand Down Expand Up @@ -115,19 +116,22 @@
// set message
document.$("#message").innerText = params.message;

// add buttons
addButtons(params.buttons);

// log message
if (params.options && params.options.logging)
console.log(`dialog - message - "${params.message}"`);

// add buttons
addButtons(params.buttons);

// call callback if set
if (typeof params.options !== "undefined" && typeof params.options.callback === "function")
params.options.callback(document);

// position dialog in parent window
position();

if (params.options && params.options.debugging)
console.debug(`total time ${new Date() - timer}ms`);
}
catch (e) {
console.error(`dialog - exception - ${e.message} - ${e.stack}`);
Expand Down

0 comments on commit 9e89394

Please sign in to comment.