Comments (10)
Yes, @laeckerv is correct - there are four codemirror instances sitting on the homepage to demonstrate concepts.
It's a bit jerky for me but nothing too serious, and I expect jerkiness on a page when I see a fully interactive REPL.
We might be able to lazy-load the REPLs using IntersectionObserver when they are fully on the page, and just add a placeholder image otherwise, but it sounds like a lot of effort for something that doesn't really seem to be too much of an issue.
from sites.
I'm pretty sure this is down to having 4 codemirror REPLs on the homepage. Without significantly decreasing the usefulness of the homepage, I think this might be a tough thing to do.
Open to ideas though.
from sites.
Iām not sure REPL is to blame, for example, here is API page (there is no REPL there) on iPhone 8:
https://share.icloud.com/photos/061yVvtTPiIPClAE6umfpIwYg
from sites.
Maybe we can try if throttling the scroll event helps? Seen two scroll event handler in Nav
and Docs
component in site-kit. I can't try it because I don't see any lags on my windows/android firefox.
from sites.
I'm pretty sure this is down to having 4 codemirror REPLs on the homepage. Without significantly decreasing the usefulness of the homepage, I think this might be a tough thing to do.
Open to ideas though.
If the REPL is to blame, what I think should happen is to remove any inactive REPL. My suggestion would be any that haven't been viewed / touched for 4 months should be purged.
from sites.
If the REPL is to blame, what I think should happen is to remove any inactive REPL. My suggestion would be any that haven't been viewed / touched for 4 months should be purged.
Pretty sure you misunderstood. @antony meant the REPLs showing as part of the landing page at https://svelte.dev/
I can't really confirm 5 seconds rendering freezes (Macbook Pro 2017, Safari 13.1.1). It stutters a tiny little bit reaching the contributors section, but other than that it seems smooth.
from sites.
@jasonlyu123 yep, some brief profiling on iPhone seems to point to scrolling events too. It seems they definitely should be throttled, especially, since there is no sidebar visible on iPhone.
On the other note, parallax scrolling on API page seems to be broken anyway, it doesn't trigger on any of my browsers, although I distinctly remember it working some time ago... What is more interesting, Sapper analogous page has parallax scrolling working and scrolls without a hitch on iPhone.
from sites.
https://web.dev/uses-passive-event-listeners/
What browsers are we looking at to support? I'd say give {passive: true}
a shot? Otherwise as mentioned perhaps try this. https://davidwalsh.name/javascript-debounce-function
Had a look at https://svelte.dev/client/index.eea181dc.js
. Would someone kindly someone give me a swift overview of what this section does?
function V(t, n) {
"static" === getComputedStyle(t).position && (t.style.position = "relative");
const e = document.createElement("object");
let o;
return (
e.setAttribute(
"style",
"display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"
),
(e.type = "text/html"),
(e.tabIndex = -1),
(e.onload = () => {
(o = e.contentDocument.defaultView).addEventListener("resize", n);
}),
/Trident/.test(navigator.userAgent)
? (t.appendChild(e), (e.data = "about:blank"))
: ((e.data = "about:blank"), t.appendChild(e)),
{
cancel: () => {
o && o.removeEventListener && o.removeEventListener("resize", n),
t.removeChild(e);
},
}
);
}
From what I understand this
- gets the computed styles for a static element with position relative
- creates an
object
element - adds style attributes to it and those change the position among others
- and then we have an onload that checks for a viewport resize
- ensuing a userAgent check
- finally removing the listener
Is this needed and what part of the page is this for?
Additionally to make things faster the REPL CSS could be inlined in the head
and async loaded before the end of body
? https://www.filamentgroup.com/lab/async-css.html https://caniuse.com/#search=preload
Checked the page in BrowserStack IOS iPhone 11 Pro Safari and even there a bit of a hiccup is felt when scrolling down and coming to the REPL section. However that might also be due to BrowserStack, could not test on a real device.
from sites.
@robots4life: It's an add_resize_listener
probably due to a bind:clientWidth
in the ReplWidget which is used on the page, and that elementresize
(?) that triggers the creation of a resize listener?
from sites.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from sites.
Related Issues (20)
- Failure loading mapbox on svelte.dev examples HOT 1
- Contrast issues on Examples page HOT 1
- REPL user menu is inaccessible HOT 3
- REPL breaks when deleting attributes HOT 2
- Todo app layout broken in animate tutorial
- Improve the component-binding example HOT 2
- Double clicking a filename other than `App.svelte` then clicking the editing area erases all the component
- Add emmet to the Repl HOT 1
- Svelte pages with REPLs start draining significant resources on Firefox when left open for a while
- Svelte REPL component name crash
- Allow loading a local folder when working on the repl
- Blog light mode style has red subtext
- Svelte docs: ts-toggle button doesn't work HOT 2
- Copy button in code blocks scrolls with overflowing content
- REPL: Add `HTML Output` tab
- HN: add https://news.ycombinator.com/best
- Unify Svelte and SvelteKit Websites HOT 1
- REPL broken / stuck on "loading editor"
- Store Svelte version in REPL and add it to `/apps` links
- REPL: Rename of file without changing name clears the file contents
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sites.