-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor: Use JsBind.Net for all JavaScript bindings and disable integra…
…tion tests temporarily
- Loading branch information
1 parent
b8301f0
commit cdafece
Showing
412 changed files
with
2,735 additions
and
20,935 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
39 changes: 39 additions & 0 deletions
39
src/WebExtensions.Net.Extensions.DependencyInjection/ServiceCollectionExtensions.cs
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,39 @@ | ||
using System.Linq; | ||
using JsBind.Net; | ||
using WebExtensions.Net; | ||
using WebExtensions.Net.Mock; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
/// <summary> | ||
/// Extension method for service registration. | ||
/// </summary> | ||
public static class ServiceCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Adds the required services for using WebExtensions API. | ||
/// </summary> | ||
/// <param name="services">The <see cref="IServiceCollection" /> to add the services to.</param> | ||
/// <returns>A reference to this instance after the operation has completed.</returns> | ||
public static IServiceCollection AddWebExtensions(this IServiceCollection services) | ||
{ | ||
services.AddJsBind(options => options.UseInProcessJsRuntime()); | ||
services.AddTransient<IWebExtensionsApi, WebExtensionsApi>(); | ||
return services; | ||
} | ||
|
||
/// <summary> | ||
/// Adds the required services for using Mock WebExtensions API. | ||
/// </summary> | ||
/// <param name="services">The <see cref="IServiceCollection" /> to add the services to.</param> | ||
/// <returns>A reference to this instance after the operation has completed.</returns> | ||
public static IServiceCollection AddMockWebExtensions(this IServiceCollection services) | ||
{ | ||
AddWebExtensions(services); | ||
// Replace registered IJsRuntimeAdapter with the mock adapter | ||
services.Remove(services.First(service => service.ServiceType == typeof(IJsRuntimeAdapter))); | ||
services.AddSingleton<IJsRuntimeAdapter, MockJsRuntimeAdapter>(); | ||
return services; | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...et.Extensions.DependencyInjection/WebExtensions.Net.Extensions.DependencyInjection.csproj
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,39 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<!-- Build properties. --> | ||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<GenerateDependencyFile>false</GenerateDependencyFile> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<IsShippingPackage>true</IsShippingPackage> | ||
<HasReferenceAssembly>false</HasReferenceAssembly> | ||
</PropertyGroup> | ||
|
||
<!-- Package properties. --> | ||
<PropertyGroup> | ||
<IsPackable>true</IsPackable> | ||
<PackageOutputPath>..\PackageOutput</PackageOutputPath> | ||
<Authors>mingyaulee</Authors> | ||
<Description>A package for service registration in WebExtensions.Net.</Description> | ||
<RepositoryUrl>https://github.com/mingyaulee/WebExtensions.Net</RepositoryUrl> | ||
<PackageTags>Browser Chrome Firefox Edge Extension Addons .Net</PackageTags> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageIcon>Icon.png</PackageIcon> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="..\Icon\Icon.png"> | ||
<Pack>true</Pack> | ||
<PackagePath></PackagePath> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="JsBind.Net.Extensions.DependencyInjection" Version="0.1.3" PrivateAssets="contentfiles" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\WebExtensions.Net\WebExtensions.Net.csproj" PrivateAssets="contentfiles" /> | ||
</ItemGroup> | ||
|
||
</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
1 change: 0 additions & 1 deletion
1
src/WebExtensions.Net.Generator/ClrTypeTranslators/FunctionDefinitionTranslator.cs
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,19 +1,16 @@ | ||
namespace WebExtensions.Net | ||
using JsBind.Net; | ||
|
||
namespace WebExtensions.Net | ||
{ | ||
/// <summary> | ||
/// Base API class. | ||
/// </summary> | ||
public class BaseApi : BaseObject | ||
public class BaseApi : ObjectBindingBase<BaseApi> | ||
{ | ||
/// <summary> | ||
/// Gets the WebExtensionsJsRuntime instance. | ||
/// </summary> | ||
protected new IWebExtensionsJSRuntime webExtensionsJSRuntime; | ||
|
||
internal BaseApi(IWebExtensionsJSRuntime webExtensionsJSRuntime, string apiNamespace) | ||
internal BaseApi(IJsRuntimeAdapter jsRuntime, string apiNamespace) | ||
{ | ||
this.webExtensionsJSRuntime = webExtensionsJSRuntime; | ||
Initialize(webExtensionsJSRuntime, "browser", apiNamespace); | ||
SetAccessPath(apiNamespace); | ||
Initialize(jsRuntime); | ||
} | ||
} | ||
} |
Oops, something went wrong.