Monday, July 31, 2023

🆕 RemoveLocalStorageItem and ClearLocalStorage

(Latest version of BASIC Anywhere Machine.)

Sample program to demo all of the local storage statements and function:

LET userName$ = GetLocalStorageItem("Prog1: userName" )

LET CountProgramRuns% = VAL( GetLocalStorageItem("Prog1: runCount" ) )  + 1
SetLocalStorageItem("Prog1: runCount" , CountProgramRuns%)

IF userName$ = "" THEN
    WHILE userName$ = "" : userName$ = _PROMPT(" Enter your user name", "") : WEND
    SetLocalStorageItem("Prog1: userName" , userName$)
END IF

PRINT "Hello, " + userName$
PRINT "This program has been run " + str$(CountProgramRuns%) + " times."

SLEEP 2
IF NOT _CONFIRM("Maintain your name in local storage?") _
   THEN RemoveLocalStorageItem("Prog1: userName")
   
IF _CONFIRM("Clear local storage?") _
   THEN PRINT "PRESS A KEY TO CLEAR LOCAL STORAGE": temp$ = INPUT$(1) : ClearLocalStorage


No comments:

Post a Comment

🖥 Fan Dance

This is a port and mod of a SpecBAS program by ZXDunny. Run the program View the source code And, a "less is more?" version: Run t...