Function runEventLoop

  • Spins the Slint event loop and returns a promise that resolves when the loop terminates.

    If the event loop is already running, then this function returns the same promise as from the earlier invocation.

    Parameters

    • Optionalargs: Function | { quitOnLastWindowClosed?: boolean; runningCallback?: Function }

      As Function it defines a callback that's invoked once when the event loop is running.

      • Function
        • runningCallback

          Optional callback that's invoked once when the event loop is running. The function's return value is ignored.

        • quitOnLastWindowClosed

          if set to true event loop is quit after last window is closed otherwise it is closed after quitEventLoop is called. This is useful for system tray applications where the application needs to stay alive even if no windows are visible. (default true).

          Note that the event loop integration with Node.js is slightly imperfect. Due to conflicting implementation details between Slint's and Node.js' event loop, the two loops are merged by spinning one after the other, at 16 millisecond intervals. This means that when the application is idle, it continues to consume a low amount of CPU cycles, checking if either event loop has any pending events.

      • { quitOnLastWindowClosed?: boolean; runningCallback?: Function }
        • OptionalquitOnLastWindowClosed?: boolean

          if set to true event loop is quit after last window is closed otherwise it is closed after quitEventLoop is called. This is useful for system tray applications where the application needs to stay alive even if no windows are visible. (default true).

          Note that the event loop integration with Node.js is slightly imperfect. Due to conflicting implementation details between Slint's and Node.js' event loop, the two loops are merged by spinning one after the other, at 16 millisecond intervals. This means that when the application is idle, it continues to consume a low amount of CPU cycles, checking if either event loop has any pending events.

        • OptionalrunningCallback?: Function

          Optional callback that's invoked once when the event loop is running. The function's return value is ignored.

    Returns Promise<unknown>