def w(): tprint('started') b = None i = [0] def a(): tprint('a') time.sleep(0.5) if i[0] < 3: i[0] += 1 else: clear_interval(b) b = set_interval(a, 1)
def w(): tprint('started') def on_message(message): tprint('w message: ' + message) on("message", on_message) b = None i = [0] def a(): tprint('a') time.sleep(0.5) post_message('hi from w again!') if i[0] < 3: i[0] += 1 else: clear_interval(b) b = set_interval(a, 1) time.sleep(0.05) post_message('hi from w!')