1 module libwasm.bindings.Clients;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.Client;
7 
8 @safe:
9 nothrow:
10 
11 struct ClientQueryOptions {
12   nothrow:
13   JsHandle handle;
14   alias handle this;
15   this(Handle h) {
16     this.handle = JsHandle(h);
17   }
18   static auto create() {
19     return ClientQueryOptions(libwasm_add__object());
20   }
21   void includeUncontrolled()(bool includeUncontrolled) {
22     Object_Call_bool__void(this.handle, "includeUncontrolled", includeUncontrolled);
23   }
24   bool includeUncontrolled()() {
25     return Object_Getter__bool(this.handle, "includeUncontrolled");
26   }
27   void type()(ClientType type) {
28     Object_Call_int__void(this.handle, "type", type);
29   }
30   ClientType type()() {
31     return Object_Getter__int(this.handle, "type");
32   }
33 }
34 enum ClientType {
35   window,
36   worker,
37   sharedworker,
38   serviceworker,
39   all
40 }
41 struct Clients {
42   nothrow:
43   JsHandle handle;
44   alias handle this;
45   this(Handle h) {
46     this.handle = JsHandle(h);
47   }
48   auto get()(string id) {
49     return JsPromise!(Any)(Object_Call_string__Handle(this.handle, "get", id));
50   }
51   auto matchAll()(scope ref ClientQueryOptions options) {
52     return JsPromise!(Sequence!(Client))(Object_Call_Handle__Handle(this.handle, "matchAll", options.handle));
53   }
54   auto matchAll()() {
55     return JsPromise!(Sequence!(Client))(Object_Getter__Handle(this.handle, "matchAll"));
56   }
57   auto openWindow()(string url) {
58     return JsPromise!(Optional!(WindowClient))(Object_Call_string__Handle(this.handle, "openWindow", url));
59   }
60   auto claim()() {
61     return JsPromise!(void)(Object_Getter__Handle(this.handle, "claim"));
62   }
63 }
64 
65