Hello!

I'm wondering, why class instance is being created while
initialization method throws an error?

var C = Class.create({
  initialization : function() {
    throw new Error('Hey, you can\'t have any instances of this
class!')
  },
  foo : 'foofoo' ,
  bar : function() {
    alert(this.foo)
  }
});

var c = new C();
c.bar();

Demo link http://jsbin.com/inoqi

Variable c should be 'undefined' I suppose, without any methods and
properties.
Seems like there is actually no way to stop instance from being
created.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to