Skip to content

check for document before appending stylesheet#7

Open
magicspon wants to merge 1 commit intosamuelmeuli:masterfrom
magicspon:issues-ssr
Open

check for document before appending stylesheet#7
magicspon wants to merge 1 commit intosamuelmeuli:masterfrom
magicspon:issues-ssr

Conversation

@magicspon
Copy link

closes #4

@magicspon magicspon marked this pull request as draft March 9, 2022 16:24
@magicspon magicspon marked this pull request as ready for review March 9, 2022 17:15
@magicspon
Copy link
Author

It still needs to be initialised when the window/document is available.

function useFontManager(
	apiKey: string,
	props: Partial<Props>,
	options: Options,
) {
	const [fontManager, setFontManager] = React.useState<FontManager>()

	React.useEffect(() => {
		if (typeof window !== 'undefined') {
			setFontManager(
				new FontManager(
					apiKey,
					props.activeFontFamily,
					options,
					props.onChange,
				),
			)
		}
	}, [])

	return fontManager
}

@ghost
Copy link

ghost commented Mar 12, 2022

sadly the whole project seems dead.
thanks to @samuelmeuli for delivering this, but I would not use it as unmaintained,

@magicspon
Copy link
Author

@bacloud22 do you know of any alternatives.

@ghost
Copy link

ghost commented Mar 24, 2022

Nope, unfortunately. Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Currently incompatible with Nextjs/SSR

1 participant