You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
theme.js is loaded very early in the rustdoc HTML documents, "to reduce theme switch latencies as much as possible:" https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/render/mod.rs#L782-L834. It seems when themes were first introduced in 003b2bc, theme.js was responsible for setting the displayed theme based on local storage. However, since 5f93159, that job is done by storage.js and theme.js is mainly responsible for setting handlers on the UI elements used to pick themes.
I think it's possible now to incorporate theme.js into main.js and reduce the number of fetches per page by 1. @GuillaumeGomez what do you think?
The text was updated successfully, but these errors were encountered:
main.js is also generated, in the sense that it's baked into rustdoc and then emitted and doc build time. rustdoc could concatenate theme.js to the end of main.js at doc build time.
Also, it looks like the only things that are interpolated into theme.js are the theme names. If we wanted to further simplify things, we could put the constant part of theme.js in main.js, and just interpolate an array containing theme names.
It's small and allow to make the switch much faster than it would if integrated into a (much) bigger file.
When you say "make the switch" do you mean the change from the default theme to the one the user has selected? Because as far as I can tell that happens in storage.js, not theme.js. theme.js seems to be all about filling in the buttons that go under the paintbrush icon, to select different themes.
You're right, my bad. Then yes, it doesn't make much sense to keep it on its own, we can simply merge it within main.js when generating the documentation. Don't know why I was sure it was handling the theme switch...
theme.js is loaded very early in the rustdoc HTML documents, "to reduce theme switch latencies as much as possible:" https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/render/mod.rs#L782-L834. It seems when themes were first introduced in 003b2bc, theme.js was responsible for setting the displayed theme based on local storage. However, since 5f93159, that job is done by storage.js and theme.js is mainly responsible for setting handlers on the UI elements used to pick themes.
I think it's possible now to incorporate theme.js into main.js and reduce the number of fetches per page by 1. @GuillaumeGomez what do you think?
The text was updated successfully, but these errors were encountered: