|
@@ -122,13 +122,13 @@ def env_var_demo():
|
|
|
@doc.demo('Background Tasks', '''
|
|
|
`background_tasks.create()` allows you to run an async function in the background and return a task object.
|
|
|
By default the task will be automatically cancelled during shutdown.
|
|
|
- You can prevent this by using the `@background_tasks.await_on_shutdown` decorator.
|
|
|
+ You can prevent this by using the `@background_tasks.await_on_shutdown` decorator (added in version 2.16.0).
|
|
|
This is useful for tasks that need to be completed even when the app is shutting down.
|
|
|
''')
|
|
|
def background_tasks_demo():
|
|
|
- from nicegui import background_tasks
|
|
|
+ # import aiofiles
|
|
|
import asyncio
|
|
|
- import aiofiles
|
|
|
+ from nicegui import background_tasks
|
|
|
|
|
|
results = {'answer': '?'}
|
|
|
|