Skip to content

Commit

Permalink
Fix date type in dynamic load test page
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Oct 10, 2024
1 parent 16376a2 commit e756690
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions docs/dynamic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
const url = 'https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-print-json.js';
globalThis.document.querySelector('main pre').classList.add('active');
const onModuleLoad = (module) => {
const pageLoaded = Number(globalThis.document.body.dataset.pageLoaded);
const pageLoaded = new Date(Number(globalThis.document.body.dataset.pageLoaded));
const moduleLoaded = new Date();
const message = {
message: 'ES Module Dynamic Loading',
Expand All @@ -61,22 +61,22 @@
buttonClicked: buttonClicked,
moduleLoaded_: moduleLoaded,
},
milliseconds: {
waitForClick: buttonClicked - pageLoaded,
loadModule: moduleLoaded - buttonClicked,
seconds: {
waitForClick: (buttonClicked - pageLoaded) / 1000,
loadModule__: (moduleLoaded - buttonClicked) / 1000,
},
};
const html = module.prettyPrintJson.toHtml(message);
const output = globalThis.document.querySelector('main output');
output.innerHTML = html;
dna.ui.fadeSlideIn(output);
dna.ui.slideFadeIn(output);
};
import(url).then(onModuleLoad);
},
setup() {
const pageLoaded = String(new Date());
globalThis.document.body.dataset.pageLoaded = pageLoaded;
globalThis.document.querySelector('main code').textContent = pageLoaded;
const now = Date.now();
globalThis.document.body.dataset.pageLoaded = String(now);
globalThis.document.querySelector('main code').textContent = Date(now).toLocaleString();
dna.dom.onClick(app.loadModule, 'main button');
libX.ui.autoDisableButtons();
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"examples": "npm test && node spec/examples.js"
},
"devDependencies": {
"@eslint/js": "~9.11",
"@eslint/js": "~9.12",
"@fortawesome/fontawesome-free": "~6.6",
"@types/node": "~22.7",
"add-dist-header": "~1.4",
Expand All @@ -88,7 +88,7 @@
"copy-folder-util": "~1.1",
"csso-cli": "~4.0",
"dna-engine": "~3.2",
"eslint": "~9.11",
"eslint": "~9.12",
"esm-to-plain-js": "~1.1",
"fetch-json": "~3.3",
"jsdom": "~25.0",
Expand All @@ -98,7 +98,7 @@
"rimraf": "~6.0",
"run-scripts-util": "~1.3",
"typescript": "~5.6",
"typescript-eslint": "~8.7",
"typescript-eslint": "~8.8",
"uglify-js": "~3.19",
"w3c-html-validator": "~1.8",
"web-ignition": "~2.2"
Expand Down
16 changes: 8 additions & 8 deletions spec/dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
const url = 'https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-print-json.js';
globalThis.document.querySelector('main pre').classList.add('active');
const onModuleLoad = (module) => {
const pageLoaded = Number(globalThis.document.body.dataset.pageLoaded);
const pageLoaded = new Date(Number(globalThis.document.body.dataset.pageLoaded));
const moduleLoaded = new Date();
const message = {
message: 'ES Module Dynamic Loading',
Expand All @@ -61,22 +61,22 @@
buttonClicked: buttonClicked,
moduleLoaded_: moduleLoaded,
},
milliseconds: {
waitForClick: buttonClicked - pageLoaded,
loadModule: moduleLoaded - buttonClicked,
seconds: {
waitForClick: (buttonClicked - pageLoaded) / 1000,
loadModule__: (moduleLoaded - buttonClicked) / 1000,
},
};
const html = module.prettyPrintJson.toHtml(message);
const output = globalThis.document.querySelector('main output');
output.innerHTML = html;
dna.ui.fadeSlideIn(output);
dna.ui.slideFadeIn(output);
};
import(url).then(onModuleLoad);
},
setup() {
const pageLoaded = String(new Date());
globalThis.document.body.dataset.pageLoaded = pageLoaded;
globalThis.document.querySelector('main code').textContent = pageLoaded;
const now = Date.now();
globalThis.document.body.dataset.pageLoaded = String(now);
globalThis.document.querySelector('main code').textContent = Date(now).toLocaleString();
dna.dom.onClick(app.loadModule, 'main button');
libX.ui.autoDisableButtons();
},
Expand Down

0 comments on commit e756690

Please sign in to comment.