RE: JScript Question About Making Reusable Code

  • From: "Homme, James" <james.homme@xxxxxxxxxxxx>
  • To: Jamal Mazrui <empower@xxxxxxxxx>, "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 25 Jul 2011 07:53:10 -0400

Hi Jamal,
Thanks for this. I need to learn so much.

Jim

-----Original Message-----
From: Jamal Mazrui [mailto:empower@xxxxxxxxx] 
Sent: Saturday, July 23, 2011 4:02 AM
To: programmingblind@xxxxxxxxxxxxx
Cc: Homme, James
Subject: Re: JScript Question About Making Reusable Code

Without recompiling EdSharp, I think the only practical way of doing 
this is to define a set of JScript functions in a file, e.g., 
MyFunctions.js.  Then evaluate the contents of that file at runtime, e.g.,
eval(File.ReadAllText('MyFunctions.js'))

I have not actually tested this.  If you happen to develop a set of 
JScript functions that you would like to be available in snippets 
without using the above technique, try adding them to the Eval.js file 
in the EdSharp program directory, and then recompiling the Eval.dll 
assembly.  Alternately, you could write classes in any .NET language, 
compile them into an assembly, and then use the import statement at the 
top of Eval.js to make them available.

Jamal

On 7/22/2011 2:20 PM, Homme, James wrote:
> Hi,
>
> In my thinking about updating the HTML snippets for EdSharp, I've come
> to the conclusion that it's a nice idea to create some generic functions
> and reuse them, rather than paste code and duplicate it multiple times.
> Here's my question. Would I have to package my code in a DLL, or is
> there some other concept in JScript like include, require, or some other
> way for a script to read in and just use some generic code? Would I have
> to recompile EdSharp so that it knows about my code, or could my snippet
> just use the code somehow?
>
> Thanks.
>
> Jim
>
> Jim Homme,
>
> Usability Services,
>
> Phone: 412-544-1810.
>
>
> This e-mail and any attachments to it are confidential and are intended
> solely for use of the individual or entity to whom they are addressed.
> If you have received this e-mail in error, please notify the sender
> immediately and then delete it. If you are not the intended recipient,
> you must not keep, use, disclose, copy or distribute this e-mail without
> the author's prior permission. The views expressed in this e-mail
> message do not necessarily represent the views of Highmark Inc., its
> subsidiaries, or affiliates.
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: