-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added p5.Vector in localStorags(#3990) #4034
Conversation
Hi @stalgiag, Could you please review it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start!
One typo that I pointed out inline. Also since you are editing functions now, we should add unit tests. The new unit test goes here. You can follow the pattern for testing color. You can find more info on writing unit tests here.
src/data/local_storage.js
Outdated
@@ -71,6 +71,8 @@ p5.prototype.storeItem = (key, value) => { | |||
case 'object': | |||
if (value instanceof p5.Color) { | |||
type = 'p5.Color'; | |||
} else if (value instanceof p5.Vector) { | |||
type = 'p5.Color'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here I believe
type = 'p5.Color'; | |
type = 'p5.Vector'; |
hi @stalgiag when I am adding the unit test and running 10 pending
Warning: [object Object] Use --force to continue. Aborted due to warnings. npm ERR! A complete log of this run can be found in: |
And the Edited file is.
|
Hi @singhvisha! So it is important to be able to do some troubleshooting and testing on your own. If you take the main error message 'TypeError: Converting circular structure to JSON' and search you will find that an object with a circular structure cannot be given as an argument to It is important to always test to make sure your changes work in a manual example before moving onto unit testing. You can use Once you have your manual tests working with all of your added features, your unit tests should work as well. Good luck! |
Hi @stalgiag , Could you please review it? |
src/data/local_storage.js
Outdated
@@ -71,6 +71,10 @@ p5.prototype.storeItem = (key, value) => { | |||
case 'object': | |||
if (value instanceof p5.Color) { | |||
type = 'p5.Color'; | |||
} else if (value instanceof p5.Vector) { | |||
type = 'p5.Vector'; | |||
let coord = [value.x, value.y, value.z]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let coord = [value.x, value.y, value.z]; | |
const coord = [value.x, value.y, value.z]; |
small request, to try to use const
whenever something doesn't need to be reassigned. Otherwise looks great!
Hi @stalgiag , Could you please review it? |
Added a new feature in which vector can be stored/retrieved in/from Local Storage(#3990 ).
closes #3990