Skip to content

Commit

Permalink
Update web.py (#5)
Browse files Browse the repository at this point in the history
add clear_localstorage
  • Loading branch information
HakunamatataLeo authored May 20, 2024
1 parent eba9eb3 commit aeee3a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pywebio_battery/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tornado.web import create_signed_value, decode_signed_value
from typing import *

__all__ = ['get_all_query', 'get_query', 'set_localstorage', 'get_localstorage', 'set_cookie', 'get_cookie',
__all__ = ['get_all_query', 'get_query', 'set_localstorage', 'get_localstorage', 'clear_localstorage', 'set_cookie', 'get_cookie',
'basic_auth', 'custom_auth', 'revoke_auth']


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

def clear_localstorage():
"""Clear user's web browser local storage"""
return eval_js("localStorage.clear()")

def _init_cookie_client():
session = get_current_session()
Expand Down

0 comments on commit aeee3a9

Please sign in to comment.