mirror of https://github.com/anoshenko/rui.git
Added RemoveClientItem to Session interface
This commit is contained in:
parent
a6707495cf
commit
2708c7ceb6
|
@ -4,6 +4,7 @@
|
||||||
* Added Start, Stop, Pause, and Resume methods to Animation interface
|
* Added Start, Stop, Pause, and Resume methods to Animation interface
|
||||||
* Added "transform" property and Transform interface
|
* Added "transform" property and Transform interface
|
||||||
* Added OpenRawResource function
|
* Added OpenRawResource function
|
||||||
|
* Added RemoveClientItem method to Session interface
|
||||||
|
|
||||||
# v0.16.0
|
# v0.16.0
|
||||||
* Can use ListAdapter as "content" property value of ListLayout
|
* Can use ListAdapter as "content" property value of ListLayout
|
||||||
|
|
|
@ -1982,7 +1982,15 @@ function getCanvasContext(elementId) {
|
||||||
|
|
||||||
function localStorageSet(key, value) {
|
function localStorageSet(key, value) {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(key, value)
|
localStorage.setItem(key, value);
|
||||||
|
} catch (err) {
|
||||||
|
sendMessage("storageError{session=" + sessionID + ", error=`" + err + "`}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function localStorageRemove(key) {
|
||||||
|
try {
|
||||||
|
localStorage.removeItem(key);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
sendMessage("storageError{session=" + sessionID + ", error=`" + err + "`}")
|
sendMessage("storageError{session=" + sessionID + ", error=`" + err + "`}")
|
||||||
}
|
}
|
||||||
|
@ -1990,7 +1998,7 @@ function localStorageSet(key, value) {
|
||||||
|
|
||||||
function localStorageClear() {
|
function localStorageClear() {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(key, value)
|
localStorage.clear();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
sendMessage("storageError{session=" + sessionID + ", error=`" + err + "`}")
|
sendMessage("storageError{session=" + sessionID + ", error=`" + err + "`}")
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,8 @@ type Session interface {
|
||||||
ClientItem(key string) (string, bool)
|
ClientItem(key string) (string, bool)
|
||||||
// SetClientItem stores a key-value pair in the client-side storage
|
// SetClientItem stores a key-value pair in the client-side storage
|
||||||
SetClientItem(key, value string)
|
SetClientItem(key, value string)
|
||||||
|
// RemoveClientItem removes a key-value pair in the client-side storage
|
||||||
|
RemoveClientItem(key string)
|
||||||
// RemoveAllClientItems removes all key-value pair from the client-side storage
|
// RemoveAllClientItems removes all key-value pair from the client-side storage
|
||||||
RemoveAllClientItems()
|
RemoveAllClientItems()
|
||||||
|
|
||||||
|
@ -879,6 +881,11 @@ func (session *sessionData) SetClientItem(key, value string) {
|
||||||
session.bridge.callFunc("localStorageSet", key, value)
|
session.bridge.callFunc("localStorageSet", key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (session *sessionData) RemoveClientItem(key string) {
|
||||||
|
delete(session.clientStorage, key)
|
||||||
|
session.bridge.callFunc("localStorageRemove", key)
|
||||||
|
}
|
||||||
|
|
||||||
func (session *sessionData) RemoveAllClientItems() {
|
func (session *sessionData) RemoveAllClientItems() {
|
||||||
session.clientStorage = map[string]string{}
|
session.clientStorage = map[string]string{}
|
||||||
session.bridge.callFunc("localStorageClear")
|
session.bridge.callFunc("localStorageClear")
|
||||||
|
|
Loading…
Reference in New Issue