Skip to content

Commit

Permalink
Add next_tick function for conveniently calling methods slightly later
Browse files Browse the repository at this point in the history
  • Loading branch information
kkinder committed Aug 3, 2024
1 parent f7c245c commit ef64111
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions puepy/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,11 @@ def remove_event_listener(elt, event, listener):
def create_proxy(obj):
return obj

def next_tick(fn):
fn()

else:
from js import document, setTimeout, Object, CustomEvent, window, history

def next_tick(fn):
setTimeout(create_proxy(fn), 100)

0 comments on commit ef64111

Please sign in to comment.