Sugar Labs
Music Blocks: Implement Storage Class
We often run out of local storage for projects. A new approach is in order.
The idea is to use localForage instead of localStorage (localForage will use indexedDB when available and localStorage when not available.)
LocalForage Implementation Tasks
- [ ] Create Storage class
- Methods:
constructor(options)
- just a localforage options object, new storage instance.
getItem(key, callback)
setItem(key, value, callback)
removeItem(key, callback)
- [ ] Port existing LocalStorage usage/methods to the new Storage class.
- find all mentions of LocalStorage
- Class properties should be renamed to
Storage
, whereas direct usage of window.localStorage should use the Storage class. - Code will need to be refactored to go through callbacks.
- Class properties should be renamed to
- find all mentions of LocalStorage
- [ ] Accept localStorage usage (in browser) and port to LocalForage.
- This will clean up the JSON.stringify/parse in the code as JS objects can be stored.
Task tags
Students who completed this task
nepaltechguy2