From c0b69002a8e411fd082deb2ba9e756d36f6ef0c1 Mon Sep 17 00:00:00 2001 From: Elie Bariche <33458222+ebariche@users.noreply.github.com> Date: Thu, 1 Jun 2023 01:51:04 -0400 Subject: [PATCH] perf: Add DispatchStorageInitialized export --- src/Uno.UI/ts/Windows/Storage/StorageFolder.ts | 10 +++++++--- src/Uno.UWP/Storage/StorageFolder.wasm.cs | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts b/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts index 4763f17f8794..6c625e95d779 100644 --- a/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts +++ b/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts @@ -69,9 +69,13 @@ namespace Windows.Storage { private static onStorageInitialized() { if (!StorageFolder.dispatchStorageInitialized) { - StorageFolder.dispatchStorageInitialized = - (Module).mono_bind_static_method( - "[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized"); + if ((globalThis).DotnetExports !== undefined) { + StorageFolder.dispatchStorageInitialized = (globalThis).DotnetExports.Uno.Windows.Storage.StorageFolder.DispatchStorageInitialized; + } else { + StorageFolder.dispatchStorageInitialized = + (Module).mono_bind_static_method( + "[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized"); + } } StorageFolder.dispatchStorageInitialized(); } diff --git a/src/Uno.UWP/Storage/StorageFolder.wasm.cs b/src/Uno.UWP/Storage/StorageFolder.wasm.cs index 4d83ef32a94d..cc1ae61f15f0 100644 --- a/src/Uno.UWP/Storage/StorageFolder.wasm.cs +++ b/src/Uno.UWP/Storage/StorageFolder.wasm.cs @@ -9,6 +9,10 @@ using System.Threading.Tasks; using Uno.Foundation.Logging; +#if NET7_0_OR_GREATER +using System.Runtime.InteropServices.JavaScript; +#endif + namespace Windows.Storage { partial class StorageFolder @@ -54,6 +58,9 @@ private struct StorageFolderMakePersistentParams public string[] Paths; } +#if NET7_0_OR_GREATER + [JSExport] +#endif internal static void DispatchStorageInitialized() { if (typeof(StorageFolder).Log().IsEnabled(Uno.Foundation.Logging.LogLevel.Debug))