Skip to content

library-styles

Injects the library’s stylesheet once per renderer, letting the newest loaded copy win.

Every plugin bundles its own copy, so several copies can share one renderer, and only one of them should own the <style> element. Each copy records the version that injected the styles in the shared state, and a copy injects only when it is newer than that record.

Interface Description
InjectLibraryStylesParams Params for injectLibraryStyles.
Function Description
injectLibraryStyles Injects the library styles, unless a copy of the same or a newer version already did.
Variable Description
LAST_LIBRARY_VERSION_KEY The shared-state key under which copies record the version that injected the styles.
LIBRARY_STYLES_ELEMENT_ID The id of the <style> element holding the library styles, so whichever copy injects last replaces the element instead of adding a second one.