-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new experimental web-specific API to preload fonts and images resources #5159
base: master
Are you sure you want to change the base?
Conversation
components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait changes
...ts/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/ResourceState.web.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the "nice" I recommend to use a "heavy" word in resource names in the doc
components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt
Outdated
Show resolved
Hide resolved
components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt
Outdated
Show resolved
Hide resolved
...ts/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt
Outdated
Show resolved
Hide resolved
...ts/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt
Outdated
Show resolved
Hide resolved
...esources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt
Outdated
Show resolved
Hide resolved
...sources/library/src/webTest/kotlin/org/jetbrains/compose/resources/TestResourcePreloading.kt
Outdated
Show resolved
Hide resolved
components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt
Outdated
Show resolved
Hide resolved
components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt
Outdated
Show resolved
Hide resolved
components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt
Outdated
Show resolved
Hide resolved
fun main() { | ||
configureWebResources { | ||
// Not necessary - It's the same as the default. We add it here just to present this feature. | ||
resourcePathMapping { path -> "./$path" } | ||
} | ||
CanvasBasedWindow("Resources demo + K/Wasm") { | ||
println("Theme = ${LocalSystemTheme.current}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println is kinda debug style. do we need it yet?
Add a new experimental web-specific API to preload fonts and images:
Using this methods in advance, it's possible to avoid FOUT (flash of unstyled text), or flickering of images/icons.
Usage example: