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 "transform" property and Transform interface | ||||
| * Added OpenRawResource function | ||||
| * Added RemoveClientItem method to Session interface | ||||
| 
 | ||||
| # v0.16.0 | ||||
| * Can use ListAdapter as "content" property value of ListLayout | ||||
|  |  | |||
|  | @ -1982,7 +1982,15 @@ function getCanvasContext(elementId) { | |||
| 
 | ||||
| function localStorageSet(key, value) { | ||||
| 	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) { | ||||
| 		sendMessage("storageError{session=" + sessionID + ", error=`" + err + "`}") | ||||
| 	} | ||||
|  | @ -1990,7 +1998,7 @@ function localStorageSet(key, value) { | |||
| 
 | ||||
| function localStorageClear() { | ||||
| 	try { | ||||
| 		localStorage.setItem(key, value) | ||||
| 		localStorage.clear(); | ||||
| 	} catch (err) { | ||||
| 		sendMessage("storageError{session=" + sessionID + ", error=`" + err + "`}") | ||||
| 	} | ||||
|  |  | |||
|  | @ -103,6 +103,8 @@ type Session interface { | |||
| 	ClientItem(key string) (string, bool) | ||||
| 	// SetClientItem stores a key-value pair in the client-side storage
 | ||||
| 	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() | ||||
| 
 | ||||
|  | @ -879,6 +881,11 @@ func (session *sessionData) SetClientItem(key, value string) { | |||
| 	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() { | ||||
| 	session.clientStorage = map[string]string{} | ||||
| 	session.bridge.callFunc("localStorageClear") | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue