resetIntl

resetIntl() destroys and removes the package default runtime.

This is the cleanest reset strategy for tests, demos, and repeated bootstraps in the same process.

ts
1import { initIntl, resetIntl, getIntl } from '@beforesemicolon/intl'2 3initIntl({ locale: 'en-US', messages: { hello: 'Hello' } })4resetIntl()5getIntl().locale // resolves to the package default initial locale logic

Signature

ts
1function resetIntl(): void

What gets cleared

It does not remove any custom scoped runtimes you created explicitly.

resetIntl() vs destroyIntl()

ts
1import { createIntl, destroyIntl, resetIntl } from '@beforesemicolon/intl'2 3const widgetRuntime = createIntl({ locale: 'en-US' })4destroyIntl(widgetRuntime) // scoped teardown5resetIntl() // default teardown

Common test setup

ts
1beforeEach(() => {2  resetIntl()3})4 5afterEach(() => {6  resetIntl()7})
edit this doc