Skip to content

Commit 87247f3

Browse files
committed
Upgrade to JavaScriptEngineSwtcher 2.0 alpha
1 parent bdbbe11 commit 87247f3

10 files changed

+45
-340
lines changed

src/JSPool.Example.Console/Program.cs

+6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
*/
77

88
using System;
9+
using JavaScriptEngineSwitcher.Core;
10+
using JavaScriptEngineSwitcher.V8;
911

1012
namespace JSPool.Example.ConsoleApp
1113
{
1214
public static class Program
1315
{
1416
static void Main(string[] args)
1517
{
18+
// Configure JavaScriptEngineSwitcher
19+
JsEngineSwitcher.Instance.EngineFactories.AddV8();
20+
JsEngineSwitcher.Instance.DefaultEngineName = V8JsEngine.EngineName;
21+
1622
var pool = new JsPool(new JsPoolConfig
1723
{
1824
Initializer = initEngine =>
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
{
1+
{
22
"version": "1.0.0-*",
33
"buildOptions": {
44
"emitEntryPoint": true
55
},
66

77
"dependencies": {
8-
"JavaScriptEngineSwitcher.Msie": "1.5.4",
8+
"JavaScriptEngineSwitcher.Core": "2.0.0-alpha1",
9+
"JavaScriptEngineSwitcher.V8": "2.0.0-alpha1",
910
"JSPool": {
1011
"target": "project"
11-
},
12-
"MsieJavaScriptEngine": "1.7.2"
12+
}
1313
},
1414

1515
"frameworks": {
16-
"net40": {
16+
"net40-client": {
1717
}
1818
}
1919
}

src/JSPool.Example.Web/App_Start/JsPoolInitializer.cs

+6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
*/
77

88
using System.Web;
9+
using JavaScriptEngineSwitcher.Core;
10+
using JavaScriptEngineSwitcher.V8;
911

1012
namespace JSPool.Example.Web
1113
{
1214
public class JsPoolInitializer
1315
{
1416
public static void Initialize()
1517
{
18+
// Configure JavaScriptEngineSwitcher
19+
JsEngineSwitcher.Instance.EngineFactories.AddV8();
20+
JsEngineSwitcher.Instance.DefaultEngineName = V8JsEngine.EngineName;
21+
1622
// Ideally this would use an IoC container, but I'm just using HttpApplicationState
1723
// to keep the example simple.
1824
HttpContext.Current.Application["jspool"] = new JsPool(new JsPoolConfig

src/JSPool.Example.Web/JSPool.Example.Web.csproj

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\JavaScriptEngineSwitcher.V8.1.5.2\build\JavaScriptEngineSwitcher.V8.props" Condition="Exists('..\packages\JavaScriptEngineSwitcher.V8.1.5.2\build\JavaScriptEngineSwitcher.V8.props')" />
3+
<Import Project="..\packages\JavaScriptEngineSwitcher.V8.2.0.0-alpha1\build\JavaScriptEngineSwitcher.V8.props" Condition="Exists('..\packages\JavaScriptEngineSwitcher.V8.2.0.0-alpha1\build\JavaScriptEngineSwitcher.V8.props')" />
44
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
55
<PropertyGroup>
66
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -45,12 +45,16 @@
4545
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4646
</PropertyGroup>
4747
<ItemGroup>
48-
<Reference Include="JavaScriptEngineSwitcher.Core, Version=1.5.0.0, Culture=neutral, PublicKeyToken=c608b2a8cc9e4472, processorArchitecture=MSIL">
49-
<HintPath>..\packages\JavaScriptEngineSwitcher.Core.1.5.0\lib\net40\JavaScriptEngineSwitcher.Core.dll</HintPath>
48+
<Reference Include="ClearScript, Version=5.4.6.0, Culture=neutral, PublicKeyToken=935d0c957da47c73, processorArchitecture=MSIL">
49+
<HintPath>..\packages\JavaScriptEngineSwitcher.V8.2.0.0-alpha1\lib\net451\ClearScript.dll</HintPath>
5050
<Private>True</Private>
5151
</Reference>
52-
<Reference Include="JavaScriptEngineSwitcher.Msie, Version=1.5.0.0, Culture=neutral, PublicKeyToken=c608b2a8cc9e4472, processorArchitecture=MSIL">
53-
<HintPath>..\packages\JavaScriptEngineSwitcher.Msie.1.5.0\lib\net40\JavaScriptEngineSwitcher.Msie.dll</HintPath>
52+
<Reference Include="JavaScriptEngineSwitcher.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c608b2a8cc9e4472, processorArchitecture=MSIL">
53+
<HintPath>..\packages\JavaScriptEngineSwitcher.Core.2.0.0-alpha1\lib\net451\JavaScriptEngineSwitcher.Core.dll</HintPath>
54+
<Private>True</Private>
55+
</Reference>
56+
<Reference Include="JavaScriptEngineSwitcher.V8, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c608b2a8cc9e4472, processorArchitecture=MSIL">
57+
<HintPath>..\packages\JavaScriptEngineSwitcher.V8.2.0.0-alpha1\lib\net451\JavaScriptEngineSwitcher.V8.dll</HintPath>
5458
<Private>True</Private>
5559
</Reference>
5660
<Reference Include="JSPool, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@@ -126,9 +130,6 @@
126130
<Content Include="Views\web.config" />
127131
<Content Include="packages.config" />
128132
<Content Include="Views\Home\Index.cshtml" />
129-
<None Include="JavaScriptEngineSwitcher.Configuration.xsd">
130-
<SubType>Designer</SubType>
131-
</None>
132133
<None Include="Web.Debug.config">
133134
<DependentUpon>Web.config</DependentUpon>
134135
</None>
@@ -164,6 +165,12 @@
164165
</FlavorProperties>
165166
</VisualStudio>
166167
</ProjectExtensions>
168+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
169+
<PropertyGroup>
170+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
171+
</PropertyGroup>
172+
<Error Condition="!Exists('..\packages\JavaScriptEngineSwitcher.V8.2.0.0-alpha1\build\JavaScriptEngineSwitcher.V8.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\JavaScriptEngineSwitcher.V8.2.0.0-alpha1\build\JavaScriptEngineSwitcher.V8.props'))" />
173+
</Target>
167174
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
168175
Other similar extension points exist, see Microsoft.Common.targets.
169176
<Target Name="BeforeBuild">

0 commit comments

Comments
 (0)