I have successfully implemented the decorator functionality:
https://anvil.works/build#clone:HO4BCOPJPAIHXBO5=5XNINH6RDK4W46IYON6BPT46
Code:
import anvil as _anvil
# from functools import wraps
class _loading_indicator:
def __enter__(self):
_anvil.js.call_js('setLoading', True)
return self
def __exit__(self, exc_type, exc_value, tb):
_anvil.js.call_js('setLoading', False)
def __call__(self, func):
# @wraps(func)
def wrapper(*args, **kw):
with self:
return func(*args, **kw)
return wrapper
loading_indicator = _loading_indicator()