Skip to content

Commit

Permalink
perf: Add DispatchStorageInitialized export
Browse files Browse the repository at this point in the history
  • Loading branch information
ebariche committed Jun 1, 2023
1 parent b0c13b1 commit c0b6900
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Uno.UI/ts/Windows/Storage/StorageFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ namespace Windows.Storage {

private static onStorageInitialized() {
if (!StorageFolder.dispatchStorageInitialized) {
StorageFolder.dispatchStorageInitialized =
(<any>Module).mono_bind_static_method(
"[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized");
if ((<any>globalThis).DotnetExports !== undefined) {
StorageFolder.dispatchStorageInitialized = (<any>globalThis).DotnetExports.Uno.Windows.Storage.StorageFolder.DispatchStorageInitialized;
} else {
StorageFolder.dispatchStorageInitialized =
(<any>Module).mono_bind_static_method(
"[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized");
}
}
StorageFolder.dispatchStorageInitialized();
}
Expand Down
7 changes: 7 additions & 0 deletions src/Uno.UWP/Storage/StorageFolder.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit c0b6900

Please sign in to comment.