-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
101 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
/*! pretty-print-json v0.4.5 ~ github.com/center-key/pretty-print-json ~ MIT License */ | ||
/*! pretty-print-json v0.5.0 ~ github.com/center-key/pretty-print-json ~ MIT License */ | ||
.json-key { color: brown; } | ||
.json-string { color: olive; } | ||
.json-number { color: navy; } | ||
.json-boolean { color: teal; } | ||
.json-null { color: dimgray; } | ||
.json-mark { color: black; } | ||
a.json-link { color: purple; transition: all 400ms; } | ||
a.json-link:visited { color: slategray; } | ||
a.json-link:hover { color: blueviolet; } | ||
a.json-link:active { color: slategray; } | ||
.dark-mode .json-key { color: indianred; } | ||
.dark-mode .json-string { color: darkkhaki; } | ||
.dark-mode .json-number { color: deepskyblue; } | ||
.dark-mode .json-boolean { color: mediumseagreen; } | ||
.dark-mode .json-null { color: darkorange; } | ||
.dark-mode .json-mark { color: silver; } | ||
.dark-mode a.json-link { color: mediumorchid; } | ||
.dark-mode a.json-link:visited { color: slategray; } | ||
.dark-mode a.json-link:hover { color: violet; } | ||
.dark-mode a.json-link:active { color: silver; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*! pretty-print-json v0.5.0 ~ github.com/center-key/pretty-print-json ~ MIT License */ | ||
.json-key { color: indianred; } | ||
.json-string { color: darkkhaki; } | ||
.json-number { color: deepskyblue; } | ||
.json-boolean { color: mediumseagreen; } | ||
.json-null { color: darkorange; } | ||
.json-mark { color: silver; } | ||
a.json-link { color: mediumorchid; transition: all 400ms; } | ||
a.json-link:visited { color: slategray; } | ||
a.json-link:hover { color: violet; } | ||
a.json-link:active { color: silver; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css> | ||
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna.css> | ||
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/reset.min.css> | ||
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/pretty-print-json@0.4/dist/pretty-print-json.css> | ||
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/pretty-print-json@0.5/dist/pretty-print-json.css> | ||
<style> | ||
body { | ||
max-width: 700px; | ||
|
@@ -44,7 +44,7 @@ <h2>ES Module Dynamic Loading</h2> | |
|
||
<main> | ||
<p>Page load:<br><code></code></p> | ||
<p><button>Reveal JSON</button></p> | ||
<p><button>Load Module</button></p> | ||
<pre><output></output></pre> | ||
</main> | ||
|
||
|
@@ -59,30 +59,34 @@ <h2>ES Module Dynamic Loading</h2> | |
<script src=https://cdn.jsdelivr.net/npm/[email protected]/dist/lib-x.min.js></script> | ||
<script> | ||
const app = { | ||
reveal(module) { | ||
const buttonClickTime = new Date(); | ||
const url = 'https://cdn.jsdelivr.net/npm/pretty-print-json@0.4/dist/pretty-print-json.esm.js'; | ||
loadModule(module) { | ||
const buttonClicked = new Date(); | ||
const url = 'https://cdn.jsdelivr.net/npm/pretty-print-json@0.5/dist/pretty-print-json.esm.js'; | ||
import(url).then(module => { | ||
const moduleLoadedTime = new Date(); | ||
const pageLoaded = $('body').data().pageLoaded; | ||
const moduleLoaded = new Date(); | ||
const message = { | ||
message: 'ES Module Dynamic Loading', | ||
version: module.prettyPrintJson.version, | ||
times: { | ||
pageLoaded___: $('body').data().pageLoadTime, | ||
buttonClicked: buttonClickTime, | ||
moduleLoaded_: moduleLoadedTime, | ||
pageLoaded___: pageLoaded, | ||
buttonClicked: buttonClicked, | ||
moduleLoaded_: moduleLoaded, | ||
}, | ||
milliseconds: { | ||
waitForClick: buttonClicked - pageLoaded, | ||
loadModule: moduleLoaded - buttonClicked, | ||
}, | ||
loadMilliseconds: moduleLoadedTime - buttonClickTime, | ||
}; | ||
const html = module.prettyPrintJson.toHtml(message); | ||
$('main output').hide().html(html).slideDown(); | ||
}); | ||
}, | ||
setup() { | ||
const pageLoadTime = new Date(); | ||
$('body').data().pageLoadTime = pageLoadTime; | ||
$('main code').text(pageLoadTime.toString()); | ||
$('main button').on({ click: app.reveal }); | ||
const pageLoaded = new Date(); | ||
$('body').data().pageLoaded = pageLoaded; | ||
$('main code').text(pageLoaded.toString()); | ||
$('main button').on({ click: app.loadModule }); | ||
libX.ui.autoDisableButtons(); | ||
}, | ||
}; | ||
|
Oops, something went wrong.