justpy icon indicating copy to clipboard operation
justpy copied to clipboard

Ajax mode doesn't work

Open longnetwork opened this issue 1 year ago • 0 comments

The tutorial example does not trigger a panel update every 2.5 seconds. the update occurs only when the page is manually refreshed

import justpy as jp
import asyncio

wp = jp.WebPage(delete_flag=False)
wp.reload_interval = 2.5
count_div = jp.Div(a=wp, classes='text-center m-4 p-4 text-white bg-blue-500', style='font-size: 200px')

async def increment_counter(start):
    count_div.counter = start
    while True:
        count_div.counter += 1
        count_div.text = str(count_div.counter)
        await asyncio.sleep(1)

def start_counting():
    jp.run_task(increment_counter(500))

def reload_demo():
    return wp

jp.justpy(reload_demo, startup=start_counting, websockets=False)

Tested for: Chromium 125.0.6422.112 and Mozilla Firefox 126.0.1

longnetwork avatar Jun 07 '24 23:06 longnetwork