Skip to content

Commit

Permalink
perf: Add DispatchMessage export
Browse files Browse the repository at this point in the history
  • Loading branch information
ebariche committed Jun 12, 2023
1 parent 62bb542 commit 9b10802
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Uno.UI/ts/Windows/Devices/Midi/MidiInPort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@

public static startMessageListener(managedId: string) {
if (!MidiInPort.dispatchMessage) {
MidiInPort.dispatchMessage = (<any>Module).mono_bind_static_method(
"[Uno] Windows.Devices.Midi.MidiInPort:DispatchMessage");
if ((<any>globalThis).DotnetExports !== undefined) {
MidiInPort.dispatchMessage = (<any>globalThis).DotnetExports.Uno.Windows.Devices.Midi.MidiInPort.DispatchMessage;
} else {
MidiInPort.dispatchMessage = (<any>Module).mono_bind_static_method(
"[Uno] Windows.Devices.Midi.MidiInPort:DispatchMessage");
}
}

const instance = MidiInPort.instanceMap[managedId];
Expand Down
5 changes: 5 additions & 0 deletions src/Uno.UWP/Devices/Midi/MidiInPort.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using Uno.Foundation;

#if NET7_0_OR_GREATER
using System.Runtime.InteropServices.JavaScript;

using NativeMethods = __Windows.Devices.Midi.MidiInPort.NativeMethods;
#endif

Expand Down Expand Up @@ -58,6 +60,9 @@ partial void StopMessageReceived()
#endif
}

#if NET7_0_OR_GREATER
[JSExport]
#endif
public static int DispatchMessage(string managedId, string serializedMessage, double timestamp)
{
#if DEBUG
Expand Down

0 comments on commit 9b10802

Please sign in to comment.