Creating new types in JScript 
Author Message
 Creating new types in JScript

How can I expose new types (not variables) to JScript code?

Say, for example, that I have a spiffy-keen new regular expression
handler (named, for lack of imagination, SpeedyRegExp).  I'd like to
write
        var re = new SpeedyRegExp();
in my JScript code, but, as far as I can tell, there's no way to do
this.  Calling AddTypeLib() adds enumerations, and nothing more; how
do I get new types defined?

Eric Brown

(By the way, I'm an MSDN universal member, yet I've written several
posts in the past couple of weeks without a response.  What do I have
to do in order to get the 72 hour response?)



Mon, 28 Jun 2004 09:07:33 GMT  
 Creating new types in JScript
If you mean classes and objects, define:

function SpeedyRegExp(reg) {
this.reg=reg;

Quote:
}

A call like you make:

var re = new SpeedyRegExp(/JavaScript/);

defines re to be a new object from the SpeedyRegExp class, with the sinlge
property, reg.

This can be used is code like:

alert("Isn't JavaScript great!!!".search(re.reg));

--
Jon Perry

http://www.users.globalnet.co.uk/~perry
BrainBench MVP for HTML and JavaScript
www.brainbench.com

Quote:
> How can I expose new types (not variables) to JScript code?

> Say, for example, that I have a spiffy-keen new regular expression
> handler (named, for lack of imagination, SpeedyRegExp).  I'd like to
> write
> var re = new SpeedyRegExp();
> in my JScript code, but, as far as I can tell, there's no way to do
> this.  Calling AddTypeLib() adds enumerations, and nothing more; how
> do I get new types defined?

> Eric Brown

> (By the way, I'm an MSDN universal member, yet I've written several
> posts in the past couple of weeks without a response.  What do I have
> to do in order to get the 72 hour response?)



Tue, 29 Jun 2004 02:25:23 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Creating new Object in JScript (IE 4.0)

2. creating a new form variable in jscript

3. Creating a new window in a new session

4. MAC IE(all) JScript Inside a dropdown, create by JScript does't work

5. How can I Create new IE window , which "leaves" in a new process, using JScript or IWebBrowser2

6. New Type 3 font from existing one

7. How to declare new variable type

8. New Types

9. Brand Spankin' New Scripting (WSH) Type Person

10. new Adobe type packages: confuse-a-user?

11. apsfilter-2.1 - new enhanced printer filter, file type auto recognition

12. type 1, type 2?, type 3 ps fonts

 

 
Powered by phpBB® Forum Software