473,394 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

converting js file into dll

I have a js file that is being accessed through an html page. This
requirement is not going to change.
At this time, a need has arisen for access to the functions of these
files from another program that is running in C# / .Net environmet. Is
there any way to convert this file from a js file to dll.
I have access to all the three codes, the only requirement is that we
want to maintain one version of the js file.

Here is an example of the working code:
a) HTML calling code
<html>
<head>
<SCRIPT LANGUAGE="JavaScript" SRC="TEng.js" ></SCRIPT>
</head>
<body>
<script type="text/javascript">
var fst = 10;
var snd = 10000;
var p = new InitEngine(fst);
document.write('<BRrandom: ' + p.EngineRank(snd) );
</script>
</body>
</html>

b) "TEng.js" file
function InitEngine(diObj)
{
// initialize the member variables for this instance
this.piObj = diObj;

// initialize the member function references for the class
prototype
if (typeof(_InitEngine_prototype_called) == 'undefined')
{
_InitEngine_prototype_called = true;
InitEngine.prototype.EngineRank = EngineRank;
InitEngine.prototype.rndm = rndm;
}
////////////////////////////////////////////////////////////////////////////
function EngineRank(posObj)
{
var sTmp = this.rndm(posObj, this.piObj);
return sTmp;
}

function rndm(a, b)
{
return a + Math.floor(Math.random()*(b-a+1));
}
}
////-----------------------------------------------

Tried compiling the dll code with visual studio's jsc command but got
the following error.
TEng.js(7,24) : error JS1135: Variable '_InitEngine_prototype_called'
has not b
een declared
TEng.js(1,9) : error JS1234: Only type and package definitions are
allowed insid
e a library

Jun 27 '08 #1
2 1315
ri*******@gmail.com wrote:
[snip]
>
Tried compiling the dll code with visual studio's jsc command but got
the following error.
TEng.js(7,24) : error JS1135: Variable '_InitEngine_prototype_called'
has not been declared
Try declaring _InitEngine_prototype_called:
var _InitEngine_prototype_called = true;

Jun 27 '08 #2
You are right: I was thinking that I needed it to be undefined... but
change the basic logic and keep the initialization process in touch.
This resolved one of the two issue. Here are the changes.
var _InitEngine_prototype_called = false;
if (_InitEngine_prototype_called == false)

Still getting the second errorJS1234: Only type and package
definitions are allowed inside a library
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rob McLennan - ZETLAND | last post by:
Hi, I am in the process of converting Dreamweaver library items to server side includes (SSI) on a website made up of ASP files. The pages I am modifying are Dreamweaver templates. The process I...
4
by: mustafa | last post by:
Dear sir , I have built my application in visual basic 6.0 and crystal Report8.5 , Now i migrated my application to VB.net using the upgrade wizard.My visual basic form is upgraded to vb.net...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
6
by: mustafa | last post by:
Dear sir , I have built my application in visual basic 6.0 and crystal Report8.5 , Now i migrated my application to VB.net using the upgrade wizard.My visual basic form is upgraded to vb.net...
16
by: manmit.walia | last post by:
Hello All, I have tried multiple online tools to convert an VB6 (bas) file to VB.NET file and no luck. I was hoping that someone could help me covert this. I am new to the .NET world and still...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.