Skip to content

v0.6.3

Compare
Choose a tag to compare
@zaydek zaydek released this 16 Nov 13:13
· 603 commits to main since this release

Runtime now accepts the environment string and returns a defer closure to clean up the runtime between, for example, hot reloads.

API looks like this:

import { Duomo } from "@zaydek/duomo/dist/runtime"

function Component() {
	useEffect(() => {
		const defer = Duomo.init(process.env.NODE_ENV)
		return defer
	}, [])

	// ...
}

For SSR, Duomo should be initialized as soon as possible only after the website hits the client — you don’t want Duomo to initialize on the server because there’s no window to attach to.

Technically, this API has nothing to do with React, so theoretically it can be invoked as a standalone JavaScript-script. However, only React has been tested so far.