That simple, it makes sense. I thought fidget did that already since it uses 
internally futures for its own HTTP get requests.

Reading the code more closely it seems you're right:

<https://github.com/treeform/fidget/blob/973ce77faff418244de95154a7ed8761d8726374/src/fidget/openglbackend.nim#L411-L413>
    
    
    while base.running:
          updateLoop()
          asyncPoll()
    
    
    Run

<https://github.com/treeform/fidget/blob/973ce77faff418244de95154a7ed8761d8726374/src/fidget/openglbackend.nim#L370-L378>
    
    
    proc asyncPoll() =
      when not defined(emscripten) and not defined(fidgetNoAsync):
        var haveCalls = false
        for call in httpCalls.values:
          if call.status == Loading:
            haveCalls = true
            break
        if haveCalls:
          poll()
    
    
    Run

It calls `poll()` only if it have registered HTTP calls.

Thank you

Reply via email to