# ClearScript

This amazing extension to Wisej.NET adds full support for server-side scripting using either VBScript, JScript or the latest Google V8 JavaScript engine. Scripts can access any object or class in the application and can attach to events fired by Wisej controls. Refer to [Microsoft’s ClearScript Reference](https://microsoft.github.io/ClearScript/Reference/html/R_Project_Reference.htm) for the ClearScript reference.

![](https://2248866391-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFp7MR1wemvcC5891_r%2F-MiWTpN_BZLDYgHvB5ZP%2F-MiWVnWwUJrSTOjqntkl%2Fimage.png?alt=media\&token=b7a66cd8-012f-4892-8a5d-96e9e5e8243e)

{% embed url="<https://github.com/iceteagroup/wisej-extensions/tree/master/Wisej.Ext.ClearScript>" %}
ClearScript Source Code
{% endembed %}

## How to Use

The **ClearScript** extension can be added to a Wisej.NET project using NuGet Package Manager.

{% embed url="<https://www.nuget.org/packages/Wisej-3-ClearScript>" %}

* Initialize engine with Wisej.Ext.ClearScript.ClearScript.Create (\<Type<)

This ClearScript extension supports the following Script [EngineTypes](https://docs.wisej.com/extensions/extensions/clearscript/api/wisej.ext.clearscript.enginetype):

* **V8**. Google V8 JavaScript.
* **JScript**. JavaScript.
* **VBScript**. VB Script.

Sample initialization:

```csharp
ScriptEngine engine;

engine = Wisej.Ext.ClearScript.ClearScript.Create(EngineType.JScript);
engine.AccessContext = GetType();
engine.AddHostObject("page", this);
engine.AddHostType("AlertBox", typeof(AlertBox));
```

Allows you to reference objects in your App from the Script:

```javascript
AlertBox.Show("Hello, World!");
page.Text = "Hello, World!";
```

{% hint style="info" %}
Find more information in our ClearScript example in [C#](https://github.com/iceteagroup/wisej-examples/tree/2.2/ClearScript) or in [VB.NET](https://github.com/iceteagroup/wisej-examples-vb/tree/main/ClearScript).
{% endhint %}

{% hint style="info" %}
Watch a video about ClearScript [online](http://wisej.s3.amazonaws.com/downloads/Examples/clearscript%20sample.mp4).
{% endhint %}
