Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/userlib/js/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ if (!canisterId) {
// Load index.js from the canister.
icHttpAgent.retrieveAsset(canisterId, 'index.js')
.then(content => {
document.body.firstElementChild.hidden = true; // "Loading ..."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .hidden property isn't a CSS thing.

I suspect that using CSS:

document.body.firstElementChild.style.visibility = 'hidden';

will be less likely to break. Two other reasons to do this.

  1. You can use CSS classes (.hidden, .visible) with the appropriate rules, and then add/remove those classes with el.classList.remove / .add / .toggle

  2. Since it's CSS you can animate the removal -- slide out, fade out, etc.

const indexJs = new TextDecoder().decode(content);
const script = document.createElement('script');
script.innerText = indexJs;
document.head.appendChild(script);
setTimeout(() => { document.head.appendChild(script) }, 10);
});
}