Difference between revisions of "Talk:Bug trackers"

From OpenHatch wiki
Jump to navigation Jump to search
imported>Paulhomebus
Line 3: Line 3:
 
I added my project AnkiDroid a few weeks ago but it still doesn't show up on OpenHatch (though another software called Anki shows up).
 
I added my project AnkiDroid a few weeks ago but it still doesn't show up on OpenHatch (though another software called Anki shows up).
  
== Hi! ==  
+
Re: Issue: #181There is a pseudo-workaround for this bug.While you caonnt do direct inheritance, you can "clone" the Array prototype and get a mostly functional length property.Code:// create your class  MyArray = function(){// instantiates the "length" property so that it is non-enumerable this.push.apply(this,[]); // set the length property to 0, otherwise it is effectively undefined this.length=0; return this;  }; // create an explicit list of Array prototype properties to "steal" as you caonnt use for/in loop to retrieve  var p=['push','concat'];// manually copy the properties from the Array prototype to MyArray prototype  for(var x=0; x<p.length; x++){ MyArray.prototype[p[x]]=Array.prototype[p[x]];  }  var a=new MyArray();  a.push(1);  alert(a.length);// 1// this fails, length property is only updated using the Array native functions  a[1]=2;  alert(a.length);// 1end codeWhile this has some obvious drawbacks,it does get you a pseudo-subclass that works across all browsers.
We are in the process of changing the way bug trackers are added, soon it will have a web interface!!
 

Revision as of 06:41, 5 May 2012

Hello?

Is this dead? I added my project AnkiDroid a few weeks ago but it still doesn't show up on OpenHatch (though another software called Anki shows up).

Re: Issue: #181There is a pseudo-workaround for this bug.While you caonnt do direct inheritance, you can "clone" the Array prototype and get a mostly functional length property.Code:// create your class MyArray = function(){// instantiates the "length" property so that it is non-enumerable this.push.apply(this,[]); // set the length property to 0, otherwise it is effectively undefined this.length=0; return this; }; // create an explicit list of Array prototype properties to "steal" as you caonnt use for/in loop to retrieve var p=['push','concat'];// manually copy the properties from the Array prototype to MyArray prototype for(var x=0; x<p.length; x++){ MyArray.prototype[p[x]]=Array.prototype[p[x]]; } var a=new MyArray(); a.push(1); alert(a.length);// 1// this fails, length property is only updated using the Array native functions a[1]=2; alert(a.length);// 1end codeWhile this has some obvious drawbacks,it does get you a pseudo-subclass that works across all browsers.