Skip to content
Discussion options

You must be logged in to vote

I find this workaround, but it's not as sophisticated as I wanted

interface AddStyleToDesktopParams {
	component: Component
	style: Record<string, string>
}

function addStyleToDesktop({
	component,
	style,
}: AddStyleToDesktopParams) {
	const devices = component.em.Devices
	const previousSelectedDevice = devices.getSelected()?.id

	devices.select('desktop', { silent: true })

	component.addStyle(style)

	if (previousSelectedDevice) {
		devices.select(previousSelectedDevice as string, {
			silent: true,
		})
	}
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@artf
Comment options

artf Feb 12, 2024
Maintainer

Answer selected by mauriciolcs2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants