e10_refresh_cache_v3#

Feature:

No matter what user entered, always return a random value between 1 and 100. And this value is based on cache that won’t change while user is typing. However, we want to provide a way to refresh the value. User can type “!~”, then the value will be refreshed after 1 seconds, and the “!~” will be removed automatically. During the waiting, it will show a helper text to tell user to wait.

Difficulty: Medium

Dependencies: NA

Demo: https://asciinema.org/a/631335

zelfred.gallery.e10_refresh_cache_v3.handler(query: str, ui: UI)[source]#

The handler is the core of a Zelfred App. It’s a user-defined function that takes the entered query and the UI object as inputs and returns a list of items to render.