-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
456 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup> | ||
<ProjectReference Include="..\GObject-2.0\GObject-2.0.csproj" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<PackageId>GirCore.JavaScriptCore-5.0</PackageId> | ||
<RootNamespace>JavaScriptCore</RootNamespace> | ||
<Description>C# bindings for JavaScriptCore.</Description> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace JavaScriptCore; | ||
|
||
public class Module | ||
{ | ||
private static bool IsInitialized; | ||
|
||
public static void Initialize() | ||
{ | ||
if (IsInitialized) | ||
return; | ||
|
||
GObject.Module.Initialize(); | ||
|
||
Internal.ImportResolver.RegisterAsDllImportResolver(); | ||
Internal.TypeRegistration.RegisterTypes(); | ||
|
||
IsInitialized = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Soup; | ||
|
||
public class Module | ||
{ | ||
private static bool IsInitialized; | ||
|
||
public static void Initialize() | ||
{ | ||
if (IsInitialized) | ||
return; | ||
|
||
Gio.Module.Initialize(); | ||
|
||
Internal.ImportResolver.RegisterAsDllImportResolver(); | ||
Internal.TypeRegistration.RegisterTypes(); | ||
|
||
IsInitialized = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Gio-2.0\Gio-2.0.csproj" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<PackageId>GirCore.Soup-3.0</PackageId> | ||
<RootNamespace>Soup</RootNamespace> | ||
<Description>C# bindings for Soup.</Description> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace WebKit2; | ||
|
||
public class Module | ||
{ | ||
private static bool IsInitialized; | ||
|
||
public static void Initialize() | ||
{ | ||
if (IsInitialized) | ||
return; | ||
|
||
Gtk.Module.Initialize(); | ||
JavaScriptCore.Module.Initialize(); | ||
Soup.Module.Initialize(); | ||
|
||
Internal.ImportResolver.RegisterAsDllImportResolver(); | ||
Internal.TypeRegistration.RegisterTypes(); | ||
|
||
IsInitialized = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
|
||
namespace WebKit2; | ||
|
||
public partial class UserContentManager | ||
{ | ||
//TODO: Is this method obsolete and the users can write it themself? | ||
//As JavaScriptResult is a record this method must be kept as long as public API for records is not generated | ||
public bool RegisterScriptMessageHandler(string name, Action<JavaScriptCore.Value> callback) | ||
{ | ||
void OnMessageReceived(UserContentManager obj, ScriptMessageReceivedSignalArgs args) | ||
{ | ||
var jsValue = Internal.JavascriptResult.GetJsValue(args.JsResult.Handle); | ||
var value = GObject.Internal.ObjectWrapper.WrapHandle<JavaScriptCore.Value>(jsValue, false); | ||
|
||
callback(value); | ||
} | ||
|
||
ScriptMessageReceivedSignal.Connect(this, OnMessageReceived, false, name); | ||
|
||
if (RegisterScriptMessageHandler(name)) | ||
return true; | ||
|
||
ScriptMessageReceivedSignal.Disconnect(this, OnMessageReceived); | ||
return false; | ||
} | ||
} |
Oops, something went wrong.