/
org.w3c.workers.kt
487 lines (419 loc) · 17.6 KB
/
org.w3c.workers.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
// See libraries/tools/idl2k for details
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
package org.w3c.workers
import kotlin.js.*
import org.khronos.webgl.*
import org.w3c.dom.*
import org.w3c.dom.css.*
import org.w3c.dom.events.*
import org.w3c.dom.parsing.*
import org.w3c.dom.svg.*
import org.w3c.dom.url.*
import org.w3c.fetch.*
import org.w3c.files.*
import org.w3c.notifications.*
import org.w3c.performance.*
import org.w3c.xhr.*
/**
* Exposes the JavaScript [ServiceWorkerRegistration](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerRegistration) to Kotlin
*/
public external abstract class ServiceWorkerRegistration : EventTarget {
open val installing: ServiceWorker?
open val waiting: ServiceWorker?
open val active: ServiceWorker?
open val scope: String
open var onupdatefound: ((Event) -> dynamic)?
open val APISpace: dynamic
fun update(): Promise<Unit>
fun unregister(): Promise<Boolean>
fun methodName(): Promise<dynamic>
fun showNotification(title: String, options: NotificationOptions = definedExternally): Promise<Unit>
fun getNotifications(filter: GetNotificationOptions = definedExternally): Promise<dynamic>
}
/**
* Exposes the JavaScript [ServiceWorkerGlobalScope](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerGlobalScope) to Kotlin
*/
public external abstract class ServiceWorkerGlobalScope : WorkerGlobalScope {
open val clients: Clients
open val registration: ServiceWorkerRegistration
open var oninstall: ((Event) -> dynamic)?
open var onactivate: ((Event) -> dynamic)?
open var onfetch: ((Event) -> dynamic)?
open var onforeignfetch: ((Event) -> dynamic)?
open var onmessage: ((Event) -> dynamic)?
open var onfunctionalevent: ((Event) -> dynamic)?
open var onnotificationclick: ((Event) -> dynamic)?
open var onnotificationclose: ((Event) -> dynamic)?
fun skipWaiting(): Promise<Unit>
}
/**
* Exposes the JavaScript [ServiceWorker](https://developer.mozilla.org/en/docs/Web/API/ServiceWorker) to Kotlin
*/
public external abstract class ServiceWorker : EventTarget, AbstractWorker, UnionMessagePortOrServiceWorker, UnionClientOrMessagePortOrServiceWorker {
open val scriptURL: String
open val state: ServiceWorkerState
open var onstatechange: ((Event) -> dynamic)?
fun postMessage(message: Any?, transfer: Array<dynamic> = definedExternally): Unit
}
/**
* Exposes the JavaScript [ServiceWorkerContainer](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerContainer) to Kotlin
*/
public external abstract class ServiceWorkerContainer : EventTarget {
open val controller: ServiceWorker?
open val ready: Promise<ServiceWorkerRegistration>
open var oncontrollerchange: ((Event) -> dynamic)?
open var onmessage: ((Event) -> dynamic)?
fun register(scriptURL: String, options: RegistrationOptions = definedExternally): Promise<ServiceWorkerRegistration>
fun getRegistration(clientURL: String = definedExternally): Promise<Any?>
fun getRegistrations(): Promise<dynamic>
fun startMessages(): Unit
}
public external interface RegistrationOptions {
var scope: String?
get() = definedExternally
set(value) = definedExternally
var type: WorkerType? /* = WorkerType.CLASSIC */
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun RegistrationOptions(scope: String? = null, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions {
val o = js("({})")
o["scope"] = scope
o["type"] = type
return o
}
/**
* Exposes the JavaScript [ServiceWorkerMessageEvent](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerMessageEvent) to Kotlin
*/
public external open class ServiceWorkerMessageEvent(type: String, eventInitDict: ServiceWorkerMessageEventInit = definedExternally) : Event {
open val data: Any?
open val origin: String
open val lastEventId: String
open val source: UnionMessagePortOrServiceWorker?
open val ports: Array<out MessagePort>?
}
public external interface ServiceWorkerMessageEventInit : EventInit {
var data: Any?
get() = definedExternally
set(value) = definedExternally
var origin: String?
get() = definedExternally
set(value) = definedExternally
var lastEventId: String?
get() = definedExternally
set(value) = definedExternally
var source: UnionMessagePortOrServiceWorker?
get() = definedExternally
set(value) = definedExternally
var ports: Array<MessagePort>?
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun ServiceWorkerMessageEventInit(data: Any? = null, origin: String? = null, lastEventId: String? = null, source: UnionMessagePortOrServiceWorker? = null, ports: Array<MessagePort>? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ServiceWorkerMessageEventInit {
val o = js("({})")
o["data"] = data
o["origin"] = origin
o["lastEventId"] = lastEventId
o["source"] = source
o["ports"] = ports
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
return o
}
/**
* Exposes the JavaScript [Client](https://developer.mozilla.org/en/docs/Web/API/Client) to Kotlin
*/
public external abstract class Client : UnionClientOrMessagePortOrServiceWorker {
open val url: String
open val frameType: FrameType
open val id: String
fun postMessage(message: Any?, transfer: Array<dynamic> = definedExternally): Unit
}
/**
* Exposes the JavaScript [WindowClient](https://developer.mozilla.org/en/docs/Web/API/WindowClient) to Kotlin
*/
public external abstract class WindowClient : Client {
open val visibilityState: dynamic
open val focused: Boolean
fun focus(): Promise<WindowClient>
fun navigate(url: String): Promise<WindowClient>
}
/**
* Exposes the JavaScript [Clients](https://developer.mozilla.org/en/docs/Web/API/Clients) to Kotlin
*/
public external abstract class Clients {
fun get(id: String): Promise<Any?>
fun matchAll(options: ClientQueryOptions = definedExternally): Promise<dynamic>
fun openWindow(url: String): Promise<WindowClient?>
fun claim(): Promise<Unit>
}
public external interface ClientQueryOptions {
var includeUncontrolled: Boolean? /* = false */
get() = definedExternally
set(value) = definedExternally
var type: ClientType? /* = ClientType.WINDOW */
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type: ClientType? = ClientType.WINDOW): ClientQueryOptions {
val o = js("({})")
o["includeUncontrolled"] = includeUncontrolled
o["type"] = type
return o
}
/**
* Exposes the JavaScript [ExtendableEvent](https://developer.mozilla.org/en/docs/Web/API/ExtendableEvent) to Kotlin
*/
public external open class ExtendableEvent(type: String, eventInitDict: ExtendableEventInit = definedExternally) : Event {
fun waitUntil(f: Promise<Any?>): Unit
}
public external interface ExtendableEventInit : EventInit {
}
@kotlin.internal.InlineOnly
public inline fun ExtendableEventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableEventInit {
val o = js("({})")
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
return o
}
/**
* Exposes the JavaScript [InstallEvent](https://developer.mozilla.org/en/docs/Web/API/InstallEvent) to Kotlin
*/
public external open class InstallEvent(type: String, eventInitDict: ExtendableEventInit = definedExternally) : ExtendableEvent {
fun registerForeignFetch(options: ForeignFetchOptions): Unit
}
public external interface ForeignFetchOptions {
var scopes: Array<String>?
get() = definedExternally
set(value) = definedExternally
var origins: Array<String>?
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun ForeignFetchOptions(scopes: Array<String>?, origins: Array<String>?): ForeignFetchOptions {
val o = js("({})")
o["scopes"] = scopes
o["origins"] = origins
return o
}
/**
* Exposes the JavaScript [FetchEvent](https://developer.mozilla.org/en/docs/Web/API/FetchEvent) to Kotlin
*/
public external open class FetchEvent(type: String, eventInitDict: FetchEventInit) : ExtendableEvent {
open val request: Request
open val clientId: String?
open val isReload: Boolean
fun respondWith(r: Promise<Response>): Unit
}
public external interface FetchEventInit : ExtendableEventInit {
var request: Request?
get() = definedExternally
set(value) = definedExternally
var clientId: String? /* = null */
get() = definedExternally
set(value) = definedExternally
var isReload: Boolean? /* = false */
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun FetchEventInit(request: Request?, clientId: String? = null, isReload: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FetchEventInit {
val o = js("({})")
o["request"] = request
o["clientId"] = clientId
o["isReload"] = isReload
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
return o
}
public external open class ForeignFetchEvent(type: String, eventInitDict: ForeignFetchEventInit) : ExtendableEvent {
open val request: Request
open val origin: String
fun respondWith(r: Promise<ForeignFetchResponse>): Unit
}
public external interface ForeignFetchEventInit : ExtendableEventInit {
var request: Request?
get() = definedExternally
set(value) = definedExternally
var origin: String? /* = "null" */
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun ForeignFetchEventInit(request: Request?, origin: String? = "null", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ForeignFetchEventInit {
val o = js("({})")
o["request"] = request
o["origin"] = origin
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
return o
}
public external interface ForeignFetchResponse {
var response: Response?
get() = definedExternally
set(value) = definedExternally
var origin: String?
get() = definedExternally
set(value) = definedExternally
var headers: Array<String>?
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun ForeignFetchResponse(response: Response?, origin: String? = null, headers: Array<String>? = null): ForeignFetchResponse {
val o = js("({})")
o["response"] = response
o["origin"] = origin
o["headers"] = headers
return o
}
/**
* Exposes the JavaScript [ExtendableMessageEvent](https://developer.mozilla.org/en/docs/Web/API/ExtendableMessageEvent) to Kotlin
*/
public external open class ExtendableMessageEvent(type: String, eventInitDict: ExtendableMessageEventInit = definedExternally) : ExtendableEvent {
open val data: Any?
open val origin: String
open val lastEventId: String
open val source: UnionClientOrMessagePortOrServiceWorker?
open val ports: Array<out MessagePort>?
}
public external interface ExtendableMessageEventInit : ExtendableEventInit {
var data: Any?
get() = definedExternally
set(value) = definedExternally
var origin: String?
get() = definedExternally
set(value) = definedExternally
var lastEventId: String?
get() = definedExternally
set(value) = definedExternally
var source: UnionClientOrMessagePortOrServiceWorker?
get() = definedExternally
set(value) = definedExternally
var ports: Array<MessagePort>?
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun ExtendableMessageEventInit(data: Any? = null, origin: String? = null, lastEventId: String? = null, source: UnionClientOrMessagePortOrServiceWorker? = null, ports: Array<MessagePort>? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableMessageEventInit {
val o = js("({})")
o["data"] = data
o["origin"] = origin
o["lastEventId"] = lastEventId
o["source"] = source
o["ports"] = ports
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
return o
}
/**
* Exposes the JavaScript [Cache](https://developer.mozilla.org/en/docs/Web/API/Cache) to Kotlin
*/
public external abstract class Cache {
fun match(request: dynamic, options: CacheQueryOptions = definedExternally): Promise<Any?>
fun matchAll(request: dynamic = definedExternally, options: CacheQueryOptions = definedExternally): Promise<dynamic>
fun add(request: dynamic): Promise<Unit>
fun addAll(requests: Array<dynamic>): Promise<Unit>
fun put(request: dynamic, response: Response): Promise<Unit>
fun delete(request: dynamic, options: CacheQueryOptions = definedExternally): Promise<Boolean>
fun keys(request: dynamic = definedExternally, options: CacheQueryOptions = definedExternally): Promise<dynamic>
}
public external interface CacheQueryOptions {
var ignoreSearch: Boolean? /* = false */
get() = definedExternally
set(value) = definedExternally
var ignoreMethod: Boolean? /* = false */
get() = definedExternally
set(value) = definedExternally
var ignoreVary: Boolean? /* = false */
get() = definedExternally
set(value) = definedExternally
var cacheName: String?
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun CacheQueryOptions(ignoreSearch: Boolean? = false, ignoreMethod: Boolean? = false, ignoreVary: Boolean? = false, cacheName: String? = null): CacheQueryOptions {
val o = js("({})")
o["ignoreSearch"] = ignoreSearch
o["ignoreMethod"] = ignoreMethod
o["ignoreVary"] = ignoreVary
o["cacheName"] = cacheName
return o
}
public external interface CacheBatchOperation {
var type: String?
get() = definedExternally
set(value) = definedExternally
var request: Request?
get() = definedExternally
set(value) = definedExternally
var response: Response?
get() = definedExternally
set(value) = definedExternally
var options: CacheQueryOptions?
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun CacheBatchOperation(type: String? = null, request: Request? = null, response: Response? = null, options: CacheQueryOptions? = null): CacheBatchOperation {
val o = js("({})")
o["type"] = type
o["request"] = request
o["response"] = response
o["options"] = options
return o
}
/**
* Exposes the JavaScript [CacheStorage](https://developer.mozilla.org/en/docs/Web/API/CacheStorage) to Kotlin
*/
public external abstract class CacheStorage {
fun match(request: dynamic, options: CacheQueryOptions = definedExternally): Promise<Any?>
fun has(cacheName: String): Promise<Boolean>
fun open(cacheName: String): Promise<Cache>
fun delete(cacheName: String): Promise<Boolean>
fun keys(): Promise<dynamic>
}
public external open class FunctionalEvent : ExtendableEvent {
}
public external @marker interface UnionClientOrMessagePortOrServiceWorker {
}
/* please, don't implement this interface! */
public external interface ServiceWorkerState {
companion object
}
public inline val ServiceWorkerState.Companion.INSTALLING: ServiceWorkerState get() = "installing".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.INSTALLED: ServiceWorkerState get() = "installed".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.ACTIVATING: ServiceWorkerState get() = "activating".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.ACTIVATED: ServiceWorkerState get() = "activated".asDynamic().unsafeCast<ServiceWorkerState>()
public inline val ServiceWorkerState.Companion.REDUNDANT: ServiceWorkerState get() = "redundant".asDynamic().unsafeCast<ServiceWorkerState>()
/* please, don't implement this interface! */
public external interface FrameType {
companion object
}
public inline val FrameType.Companion.AUXILIARY: FrameType get() = "auxiliary".asDynamic().unsafeCast<FrameType>()
public inline val FrameType.Companion.TOP_LEVEL: FrameType get() = "top-level".asDynamic().unsafeCast<FrameType>()
public inline val FrameType.Companion.NESTED: FrameType get() = "nested".asDynamic().unsafeCast<FrameType>()
public inline val FrameType.Companion.NONE: FrameType get() = "none".asDynamic().unsafeCast<FrameType>()
/* please, don't implement this interface! */
public external interface ClientType {
companion object
}
public inline val ClientType.Companion.WINDOW: ClientType get() = "window".asDynamic().unsafeCast<ClientType>()
public inline val ClientType.Companion.WORKER: ClientType get() = "worker".asDynamic().unsafeCast<ClientType>()
public inline val ClientType.Companion.SHAREDWORKER: ClientType get() = "sharedworker".asDynamic().unsafeCast<ClientType>()
public inline val ClientType.Companion.ALL: ClientType get() = "all".asDynamic().unsafeCast<ClientType>()