Before we were passing in the Wikicite object so we could access its string formatting functions.
This worked for base formatting, but not if the dialog window called a function that then called further string formatting (eg. getPID) because this didn't use the Wikicite object we passed in, but a secondary imported one, and the addon object used for localisation in src/utils/locale.ts was undefined.
To fix this, we instead pass in the addon object and assign it to window so it's globally accessible within the window.
Ideally it should be possible to configure this with esbuild, or to assign to globalThis instead of window (see eg. here) but we can address this later.
Before we were passing in the
Wikicite
object so we could access its string formatting functions.This worked for base formatting, but not if the dialog window called a function that then called further string formatting (eg.
getPID
) because this didn't use the Wikicite object we passed in, but a secondary imported one, and theaddon
object used for localisation insrc/utils/locale.ts
was undefined.To fix this, we instead pass in the
addon
object and assign it towindow
so it's globally accessible within the window.Ideally it should be possible to configure this with esbuild, or to assign to
globalThis
instead ofwindow
(see eg. here) but we can address this later.