Skip to content

Commit

Permalink
chore: Adjust invokejs semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Sep 5, 2024
1 parent aa6fdd2 commit 70a016a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
#nullable enable

using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.CompilerServices;
Expand All @@ -17,7 +19,7 @@ internal sealed partial class Runtime
internal static partial string InvokeJS(string value);

[JSImport("globalThis.MonoSupport.jsCallDispatcher.invokeJSUnmarshalled")]
internal static partial IntPtr InvokeJSUnmarshalled(string functionIdentifier, IntPtr arg0, IntPtr arg1, IntPtr arg2);
internal static partial IntPtr InvokeJSUnmarshalled(string? functionIdentifier, IntPtr arg0, IntPtr arg1, IntPtr arg2);
}

namespace JSInterop
Expand Down
6 changes: 4 additions & 2 deletions src/Uno.UI/ts/Interop/Runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
return "";
}

public static InvokeJS(command: string) : string {
return eval(command);
public static InvokeJS(command: string): string {
// Preseve the original emscripten marshalling semantics
// to always return a valid string.
return String(eval(command) || "");

Check warning on line 12 in src/Uno.UI/ts/Interop/Runtime.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Uno.UI/ts/Interop/Runtime.ts#L12

forbidden eval
}
}
}

0 comments on commit 70a016a

Please sign in to comment.