Scoop API

scoop:scoop.window.asyncio:0.1.0

src/host.scoop

Selected production source · src/host.scoop

1package scoop.window.asyncio
3import scoop.asyncio.host.*
4import scoop.window.native.*
6/** Adapts the application's actual native host to the asyncio notification contract. */
7public class WindowLoopHost public constructor(private val host: ApplicationHost): EventLoopHost {
8 public override fun isCurrentThread(): Boolean = host.isCurrentThread()
9 /** Installs a borrowed platform notification without an inline ready callback. */
10 @Unsafe
11 public override fun watch(
12 notification: EventLoopNotification,
13 ready: () -> Unit
14 ): EventLoopWatch {
15 return WindowLoopWatch(platformWatch(host, notification, ready))
16 }
19private class WindowLoopWatch(private val watch: ApplicationWatch): EventLoopWatch {
20 public override fun remove(onRemoved: () -> Unit) {
21 watch.remove(onRemoved)
22 }