Hello,
Have you find the answer ?
Hi @Fmedioni
Here is an example of using localStorage to store the scene.
scene-localStorage.zip (90.9 KB)
Many thanks, your Example helped me a lot!!!
hi @mastermindcoach , and @DBear …
it isnt working on safari 12.
is there a problem on my Safari of Mac, or it s a common issue?
Thanks…
This is magic! Nice work and great demo.
Hi Dear
In the example you provided you have a function where you clear local storage:
localStorage.clear();
Is there a way to only clear the names of the scenes recorded instead of cleaning all local storage. There may be other things stored there which I may still need.
Looking forward to your reply.
Greg
you can use
localStorage.removeItem('myKey');
turning on your preferred searchengine with query like “js localStorage” will lead to several sources describing usage, methods …
Hi Hans
I will definitely learn more about localStorage for sure! Just one more question. Can I list several items e.g.
localStorage.removeItem('myKey', 'myKey2', 'myKey3');
Thanks for your help.
Greg
no remove one at a time or clear all …
let keysToRemove = ["key1", "next"];
for (key of keysToRemove) {
localStorage.removeItem(key);
}
as iteration ...
Hi Hans
I dug a little into local storage and came up with this. In this little project, not only the scene name but also the state of each timeline within each scene are stored in local storage and are kept the same even when you reload the page or close the browser accidentally.
Store Scene and Timeline (Local Storage).zip (88.7 KB)
Hope you like it and please feel free to improve it if you have a better ideas
Thanks guys!
Hi Greg,
When convenient would it be possible for you to save this project in a version which is compatible for Hype 3 to open.
Would be helpful to see how you used local storage.
Thanks.
Sure! But how would I do that? I use Hype 4 Pro. Is there an option to export as a project for earlier versions of Hype?
Thanks for the reply Greg… I thought there might be an option when exporting in Hype 4, but it doesn’t sound like it.
Alternatively if you wouldn’t mind, I think if you were to “Export as HTML 5” and upload the two files (.html file and .hyperesources folder) I would be able to create an editable file using Hypes “Restore document from export” feature.
Thanks again.
I suspect that that may have issues.
The plist file fir the restore will be markedly different.
I suspect that we have a v3 example that does similar on the site somewhere…
LocalStorage is not too complicated and you should be able to construct your own by going over this thread or some of the ithers on site
Thanks for uploading @grzesiek.rogala … I thought it would be a work around, @MarkHunte was right though.
Will look on the forums see if there is similar on v3.
Thanks again for your help guys.
I have adapted the one from
It will open in v3.
keepSceneAndTimelinedata.hypetemplate.zip (180.8 KB)
Thank you Mark thats great, I will take a look!
Here's a version of @dbear's localstorage example that remembers the state of timelines:
// set the point in a timeline
localStorage.switch1time = hypeDocument.currentTimeInTimelineNamed('switch1')
// read it back and set it, if present
if (localStorage.switch1time){ // if there is a variable stored (returns true)
hypeDocument.goToTimeInTimelineNamed(localStorage.switch1time, 'switch1')
}
localstorage - button toggle.hype.zip (194.4 KB)
Here's a version of @daniel's example of @dbear's localstorage example that remembers the state of timelines without having to hard code scene names or timelines.
Can store multiple timelines for the scene.
localstorage - button toggle.hype 2.zip (231.3 KB)