Skip to content
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

check for document before appending stylesheet #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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