Help wanted - localforage is not defined
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 3.9k
- Forks
- 579
- PR merge metrics
- No merged PRs in 30d
Description
It is mentioned in the API that
WebGazer.js can save and restore the training data between browser sessions by storing data to the browser using localforage, which uses IndexedDB. This occurs automatically with every click in the window. If you want each user session to be independent make sure that you set window.saveDataAcrossSessions in main.js to false.
However, I am unable to save data between sessions, neither on local development nor on https://webgazer.cs.brown.edu/calibration.html even though window.saveDataAcrossSessions=true;. Upon reloading the page, the navigation bar states "Not Yet Calibrated".
Also, I experimented by typing localforage.getItem("webgazerGlobalData") into the console but the response is:
Uncaught ReferenceError: localforage is not defined
at <anonymous>:1:1
It is my understanding that localforage is utilized automatically when webgazer.begin() is called:
src_webgazer.begin = function(onFail) {
if (window.location.protocol !== 'https:' && window.location.hostname !== 'localhost' && window.chrome){
alert("WebGazer works only over https. If you are doing local development you need to run a local server.");
}
// Load model data stored in localforage.
if (window.saveDataAcrossSessions) {
loadGlobalData();
}
It is worth noting that onload, which is when webgazer.begin() is called, there is a console.log("loaded stored data into regression model");, which is called from within loadGlobalData().
What do I need to do to use localforage and ensure it is working so that data is saved between sessions?
Once this is working, it should be able to load calibration data for any of the webgazer pages, correct?
Also, with localforage, is it stored in memory or on disk, i.e. will it survive a restart?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the localforage usage from src_webgazer.begin and loadGlobalData(), then compare that path with calibration.html in both local development and the deployed page. Check whether the reported localforage ReferenceError explains the missing persisted training data. Done means calibration data loads after reloading a page and the expected persistence behavior is verified across a browser restart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100