"Renderer is not a constructor"
See original GitHub issueThis is not a direct issue for us, but to help you improve your code, I thought I’d share something I found. We are getting the Exception “i is not a constructor”. You can safely catch and ignore the exception, and everything seems to work fine, but it is still there.
My code now is the following:
try {
JsBarcode(imgID, barValue, {format:barFormat, displayValue:showValue, fontSize:parseInt(barFont), width:parseInt(barWidth), height:parseInt(barHeight), ratio:0.8});
} catch (err) {
jslog("Error when using JsBarcode: " + err.message);
//There is an error in JsBarcode we need to ignore (ie: i is not a constructor)
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:25 (14 by maintainers)
Top Results From Across the Web
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >Uncaught TypeError: Renderer is not a constructor - Odoo
Hello, I am trying to display two form view of differernt model on same window.example one form is survey_form of survey.survey and second ......
Read more >THREE.WEBGLRenderer is not a constructor error in three js
Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
Read more >WebGLRenderer – three.js docs
The WebGL renderer displays your beautifully crafted scenes using WebGL. ... This is automatically created by the renderer in the constructor (if not...
Read more >Your First three.js Scene: Hello, Cube!
Last but not least, there's a visible object such as a mesh. ... The constructor for the renderer does take several parameters, however,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is absolutely the reason! I know to not loop over array with
for in
but sometimes you do the simplest thing you know are going to work (on your machine).I will patch the issue sometime this weekend.
Thanks very much for the assistance!
@lindell I think I know what is causing the problem. I couldn’t get the issue reproduced in a codepen snippet or something, so I started to do some digging myself.
I discovered that the are some places where you iterate over an array using a for loop. That would be a normal thing in plain javascript, however in my case, I am using this library inside an Ember.js project. Ember.js extends the prototype of
Array
with a lot of extra functions, somehow causing extra keys.In a plain javascript console, iterating over array keys looks like this:
However, in an Ember.js project, it looks like this:
Finally, this causes this location in your project to fail:
That also explains why the barcode is still rendered (on the first iteration) and why it is rendering more then once (for each key).
Probably the other people that are having this problem are also using a library that manipulates the array prototype. This is probably an example of why prototype extensions are a bad idea haha. However, this could be fixed by using something like this to iterate (in es6):
So, here is a codepen example that does reproduce the issue: http://codepen.io/anon/pen/EgxLBB