- DelphiTools - https://www.delphitools.info -

DWS WebServer with JavaScript CodeGen

dws web serverThe pre-compiled 2014.10.13 version of the DWScript WebServer is now available!

This version includes the Pascal to JavaScript CodeGen!

Here is the download link for the installer:

DWSWebServer 2014.10.13 [1] (1541 kB)

This version also includes all fixes and improvements in DWScript, but the main attraction is the Pascal to JavaScript compiler, which bundles a limited version of SmartMobile Studio [2] compiler. It can be invoked in two ways:

There is only one sample currently, “op4js.dws”, which is a minimalistic illustration of both script execution contexts:

<h3 style="color:blue">Hello OP4JS!</h3>
<div id="count">???</div>
// executed server-side when generating page
var i : Integer;
for i := 1 to 5 do
 PrintLn(Format('Test %d<br/>', [i]));
<script type="pascal">
// compiled into javascript
   doc external "document",
   win external "window" : Variant;

var counter : Integer;

procedure IncrementCounter;
   var countDiv := doc.getElementById('count');
   countDiv.innerHTML := IntToStr(counter);
   win.setTimeout(@IncrementCounter, 1000);



it gets compiled into


<h3 style="color:blue">Hello OP4JS!</h3>
<div id="count">???</div>

Test 1<br/>
Test 2<br/>
Test 3<br/>
Test 4<br/>
Test 5<br/>

function IncrementCounter() {
 var countDiv;
 countDiv = document.getElementById("count");
 countDiv.innerHTML = counter.toString();
var counter = 0;


Future posts will introduce more advanced usage scenarios!