Skip to content

Commit aeee3a9

Browse files
Update web.py (#5)
add clear_localstorage
1 parent eba9eb3 commit aeee3a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pywebio_battery/web.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from tornado.web import create_signed_value, decode_signed_value
66
from typing import *
77

8-
__all__ = ['get_all_query', 'get_query', 'set_localstorage', 'get_localstorage', 'set_cookie', 'get_cookie',
8+
__all__ = ['get_all_query', 'get_query', 'set_localstorage', 'get_localstorage', 'clear_localstorage', 'set_cookie', 'get_cookie',
99
'basic_auth', 'custom_auth', 'revoke_auth']
1010

1111

@@ -39,6 +39,9 @@ def get_localstorage(key: str) -> str:
3939
"""Get the key's value in user's web browser local storage"""
4040
return eval_js("localStorage.getItem(key)", key=key)
4141

42+
def clear_localstorage():
43+
"""Clear user's web browser local storage"""
44+
return eval_js("localStorage.clear()")
4245

4346
def _init_cookie_client():
4447
session = get_current_session()

0 commit comments

Comments
 (0)