How do I use session variables with localstorage plugin

Get help using Construct 2

Post » Sat Oct 31, 2015 4:00 pm

since the webstorage plugin was replaced by localstorage plugin
how do i store session variables with localstorage plugin?

yes i only want these variables to last for a session.
B
9
S
2
Posts: 76
Reputation: 709

Post » Sat Oct 31, 2015 4:16 pm

'Session storage' has been removed in the new plugin, since it had no benefits over using global variables and added a lot of baggage.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Oct 31, 2015 5:11 pm

benefits,I beg to differ,

If i want a login session to only last a session, meaning when user exits browser the session should be gone.
how can this be solved with localstorage global variables?
B
9
S
2
Posts: 76
Reputation: 709

Post » Sat Oct 31, 2015 5:26 pm

why would you need to store anything?
Wouldn't using/setting a global variable do the job?
When restarting all global variables are reset to their original values..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Oct 31, 2015 5:55 pm

why store values?
i need to pass data between 2 apps without query strings.
i need to store data since another app will read the value t so no global variable will work.
B
9
S
2
Posts: 76
Reputation: 709

Post » Sat Oct 31, 2015 6:15 pm

Ok..
I've never read about one app being able to read the webstorage from another..
But if needed that way, wouldn't resetting the local storage on end of session work?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Nov 01, 2015 12:17 pm

althogh that might work technically, you kinda miss the point of html5 webstorage ,
as when the browser is closed (and you cannot do any error handling) all session storage is removed as the session dies when browser is closed.localstorage however your data isn't removed.
my point is that scirra removed support for 1 plugin in favour of one without the same functionality.
as the old webstorage plugin wore perfectly for me , i'm trying to figure out why it was removed if not the same functionality is offered.
B
9
S
2
Posts: 76
Reputation: 709

Post » Sun Nov 01, 2015 12:24 pm

Like I said, this is the reason Scirra gave:

LittleStain wrote:'Session storage' has been removed in the new plugin, since it had no benefits over using global variables and added a lot of baggage.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Nov 01, 2015 1:25 pm

my argument is that localstorage and session storage aren't the same thing,
excerpt from scirra manual:

"Local vs. Session storage
The WebStorage object allows data to be stored in two places: Local storage and Session storage.

Local storage is permanent (until the user clears their cache). If the user comes back the next day, local storage still has the saved data.

Session storage only lasts with the current browser session. If the user comes back the next day, session storage is empty again."

hence they removed functionality and claims it's an improvement.
i couldnt care less if the replaced the plugin with one that has same functionality, but this wasn't the case.
and to build functionality that is part of the html5 stack isn't really productive.
B
9
S
2
Posts: 76
Reputation: 709


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests