mirror of
https://github.com/ae-utbm/sith.git
synced 2026-05-22 08:50:17 +00:00
replace exportToHtml by Object.assign(window, { obj })
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// biome-ignore lint/performance/noNamespaceImport: this is the recommended way from the documentation
|
||||
import * as Sentry from "@sentry/browser";
|
||||
import { exportToHtml } from "#core:utils/globals.ts";
|
||||
|
||||
interface LoggedUser {
|
||||
name: string;
|
||||
@@ -13,7 +12,7 @@ interface SentryOptions {
|
||||
user?: LoggedUser;
|
||||
}
|
||||
|
||||
exportToHtml("loadSentryPopup", (options: SentryOptions) => {
|
||||
const loadSentryPopup = (options: SentryOptions) => {
|
||||
Sentry.init({
|
||||
dsn: options.dsn,
|
||||
});
|
||||
@@ -21,4 +20,5 @@ exportToHtml("loadSentryPopup", (options: SentryOptions) => {
|
||||
eventId: options.eventId,
|
||||
...(options.user ?? {}),
|
||||
});
|
||||
});
|
||||
};
|
||||
Object.assign(window, { loadSentryPopup });
|
||||
|
||||
@@ -5,17 +5,3 @@ declare global {
|
||||
const gettext: (text: string) => string;
|
||||
const interpolate: <T>(fmt: string, args: string[] | T, isNamed?: boolean) => string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to export typescript functions to regular html and jinja files
|
||||
* Without it, you either have to use the any keyword and suppress warnings or do a
|
||||
* very painful type conversion workaround which is only here to please the linter
|
||||
*
|
||||
* This is only useful if you're using typescript, this is equivalent to doing
|
||||
* window.yourFunction = yourFunction
|
||||
**/
|
||||
// biome-ignore lint/suspicious/noExplicitAny: Avoid strange tricks to export functions
|
||||
export function exportToHtml(name: string, func: any) {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: Avoid strange tricks to export functions
|
||||
(window as any)[name] = func;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user