Note that the code "new sqlite.Database" fails to create a database
because it needs an argument.
Franky
Op 28/01/2011 16:49, wayne schreef:
> I'm trying to create an object based on a GS library object that I can
> give additional properties& reuse. Why doesn't the following work?
But the general right way to what you're tring to do would be this
(but it doesn't work here);
var inheritingContructor=function(arg0){
baseContructor.call(this,arg0);
};
(function(){
var tempCtor=function(){};
tempCtor.prototype=baseContructor.prototype;
inheritingContructor.prototype=new tempCtor();
})();
inheritingContructor.prototype.myProp=true;
On Fri, Jan 28, 2011 at 7:16 PM, bryan t <yamt...@gmail.com> wrote:
> Ok thanks, I'm new to JS & just want to make sure I'm doing it right
>
> On Fri, Jan 28, 2011 at 9:14 AM, <hanssc...@gmail.com> wrote:
>> That sadly rarely works with builtin objects...
>> the best way is probably mirroring the the DOM approach, using a create
>> function. It's not technically inheritance but it works.
>>
>> var sqlite = require("sqlite");
>>
>> var MyDatab=function(){
>> throw("use createMyDatab to initiate");
>> };
>>
>> MyDatab.prototype={
>> myProp:true
>> };
>>
>> var createMyDatab(fname){
>> var r=new sqlite.Database(fname);
>> for(var i in MyDatab.prototype)
>> r[i]=MyDatab.prototype[i];
>>
>> return r;
>> };
>>> --
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "GLUEscript" group.
>>>
>>> To post to this group, send email to glues...@googlegroups.com.
>>>
>>> To unsubscribe from this group, send email to
>>> gluescript+...@googlegroups.com.
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/gluescript?hl=en.
>>>
>>>
>>>
>>>
>
--
Hans Schmucker
Mannheim
Germany
hanssc...@gmail.com
http://www.tapper-ware.net
Franky
Op 28/01/2011 16:49, wayne schreef:
> I'm trying to create an object based on a GS library object that I can
> give additional properties& reuse. Why doesn't the following work?