OiWorld / MindTheWord

An extension for Google Chrome that helps people learn new languages while they browse the web.
43 stars 47 forks source link

Extra expression added to make logic more robust #103

Closed dev-shady closed 8 years ago

dev-shady commented 8 years ago

Somehow '!savedPatterns' not able to check for undefined' value. issue #102

dev-shady commented 8 years ago

it is same as one of: https://github.com/OiWorld/MindTheWord/blob/master/Troubleshooting/Troubleshooting.md

Cause of above mentioned problem: When the Turn On button is clicked instead of Options on fresh installation of the extension, toggle enabled function in pop.js is invoked. It initialises the local storage data with 'activation=true' as only attribute, and causing others to be undefined. And when the options buttion is clicked, option.js page loads and in loadStorageAndUpdate function, at line 421, the data is not null, JSON.stringify(data) is not empty and shockingly, data.savedPatterns (which is undefined too) also evalutes to false, thus skipping to set data to default storage. The same data values are used everywhery and the values of all other items remains undefined, causing the trouble. I hope i am able to explain the reason.