Cannot assign to read only property 'data' of object
See original GitHub issueWhen using heatmap.js on certain browsers, this error Cannot assign to read only property 'data' of object shows up.

I’m able to reproduce on chromium that is packaged with electron version 1.3.3.
This seems to happen because the data property of ImageData object is being replaced directly in this part of the code. https://github.com/pa7/heatmap.js/blob/master/src/renderer/canvas2d.js#L280
data property seems to be read only on certain browser versions. To fix it, we need to delete this line because imgData and img.data points to the same reference. Any modifications you do to imgData is already reflected to img.data. I’ll put up a PR soon.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:13
Top Results From Across the Web
Uncaught TypeError: Cannot assign to read only property
When you use Object.defineProperties , by default writable is set to false , so _year and edition are actually read only properties.
Read more >Cannot assign to read only property of Object in JavaScript
The error "Cannot assign to read only property of object" occurs when we try to change a property of an object that has...
Read more >Cannot assign to read only property '<field_name>' of ...
This type of error(Cannot assign to read-only property) generally occurs on update of public property @api decorator variable value.
Read more >TypeError: "x" is read-only - JavaScript - MDN Web Docs
The JavaScript strict mode-only exception "is read-only" occurs when a global variable or object property that was assigned to is a read-only property....
Read more >Cannot assign to read only property 'X' of object '#<Object>'
This is most likely the issue, wired properties are immutable I believe. Best way to handle this is by using the spread operator...
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 Free
Top 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
I’m facing the same issue using heatmapjs in my Angular application.
so how can this problem be solved in version 2.0.5