Indeed, what I have to do sucks. Though also, the fetching should be instant
since the browsers should cache, and then I only parse once. And, its only
necessary in IE since 'var a' doesn't set the global 'a' like other
browsers.

Sean McArthur
On Dec 6, 2010 11:04 PM, "אריה גלזר" <[email protected]> wrote:
> how about this?
> http://jsfiddle.net/ariehg/PFe7C/
>
> I know you are looking for a name accessor but looking through Sean's code
> just made me sure this is simply not worth the while. The above Object.isA
> is not less readable but much much faster and easier to maintain than
> *fetching and parsing all script tags in the page*.
>
> On Mon, Dec 6, 2010 at 7:59 PM, Sean McArthur <[email protected]
>wrote:
>
>> I use a GetClass mixin, but it has some limitations. Specifically, it
can't
>> find the class name if the class is nested on an object.
>>
>> So, (new MyClass).get_class() = 'MyClass'
>> But, (new NameSpace.MyClass).get_class() fails.
>>
>>
https://github.com/seanmonstar/monstars.js/blob/master/src/mvc/GetClass.js
>>
>>
>>
>>
>> On Mon, Dec 6, 2010 at 6:45 AM, אריה גלזר <[email protected]> wrote:
>>
>>> IMO you can't. What you can do is
>>> assertTrue(MyClass instanceof MyGenerricClass);
>>>
>>>
>>> On Mon, Dec 6, 2010 at 4:43 PM, ZsZs <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'd like to have the following behavior:
>>>>
>>>> var MyGenericClass = new Class({getClass: function(){ ... }});
>>>> var myObject = new MyGenericClass();
>>>> assertEquals( "MyGenericClass", myObject.getClass() );
>>>>
>>>> How should I implement getClass?
>>>> I tried:
>>>> this.constructor.toString().match( /function (\w+)\(.+/ )[1];
>>>> which worked for ordinary objects but doesn't works with MooTools
>>>> objects?
>>>>
>>>> Thank you,
>>>> Zsolt
>>>>
>>>> I know I'm too much Java oriented, I'd like to reuse the patters
>>>> worked for me on server side. Sorry.
>>>
>>>
>>>
>>>
>>> --
>>> Arieh Glazer
>>> אריה גלזר
>>> 052-5348-561
>>> http://www.arieh.co.il
>>> http://www.link-wd.co.il
>>>
>>>
>>
>
>
> --
> Arieh Glazer
> אריה גלזר
> 052-5348-561
> http://www.arieh.co.il
> http://www.link-wd.co.il

Reply via email to