/
org.w3c.files.kt
119 lines (102 loc) · 3.43 KB
/
org.w3c.files.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
/*
* Generated file
* DO NOT EDIT
*
* See libraries/tools/idl2k for details
*/
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
package org.w3c.files
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.notifications.*
import org.w3c.performance.*
import org.w3c.workers.*
import org.w3c.xhr.*
/**
* Exposes the JavaScript [Blob](https://developer.mozilla.org/en/docs/Web/API/Blob) to Kotlin
*/
public external open class Blob(blobParts: Array<dynamic> = definedExternally, options: BlobPropertyBag = definedExternally) {
open val size: Int
open val type: String
open val isClosed: Boolean
fun slice(start: Int = definedExternally, end: Int = definedExternally, contentType: String = definedExternally): Blob
fun close(): Unit
}
public external interface BlobPropertyBag {
var type: String? /* = "" */
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun BlobPropertyBag(type: String? = ""): BlobPropertyBag {
val o = js("({})")
o["type"] = type
return o
}
/**
* Exposes the JavaScript [File](https://developer.mozilla.org/en/docs/Web/API/File) to Kotlin
*/
public external open class File(fileBits: Array<dynamic>, fileName: String, options: FilePropertyBag = definedExternally) : Blob {
open val name: String
open val lastModified: Int
}
public external interface FilePropertyBag : BlobPropertyBag {
var lastModified: Int?
get() = definedExternally
set(value) = definedExternally
}
@kotlin.internal.InlineOnly
public inline fun FilePropertyBag(lastModified: Int? = null, type: String? = ""): FilePropertyBag {
val o = js("({})")
o["lastModified"] = lastModified
o["type"] = type
return o
}
/**
* Exposes the JavaScript [FileList](https://developer.mozilla.org/en/docs/Web/API/FileList) to Kotlin
*/
public external abstract class FileList : ItemArrayLike<File> {
override val length: Int
override fun item(index: Int): File?
}
@kotlin.internal.InlineOnly inline operator fun FileList.get(index: Int): File? = asDynamic()[index]
/**
* Exposes the JavaScript [FileReader](https://developer.mozilla.org/en/docs/Web/API/FileReader) to Kotlin
*/
public external open class FileReader : EventTarget {
open val readyState: Short
open val result: dynamic
open val error: dynamic
var onloadstart: ((Event) -> dynamic)?
var onprogress: ((Event) -> dynamic)?
var onload: ((Event) -> dynamic)?
var onabort: ((Event) -> dynamic)?
var onerror: ((Event) -> dynamic)?
var onloadend: ((Event) -> dynamic)?
fun readAsArrayBuffer(blob: Blob): Unit
fun readAsBinaryString(blob: Blob): Unit
fun readAsText(blob: Blob, label: String = definedExternally): Unit
fun readAsDataURL(blob: Blob): Unit
fun abort(): Unit
companion object {
val EMPTY: Short
val LOADING: Short
val DONE: Short
}
}
/**
* Exposes the JavaScript [FileReaderSync](https://developer.mozilla.org/en/docs/Web/API/FileReaderSync) to Kotlin
*/
public external open class FileReaderSync {
fun readAsArrayBuffer(blob: Blob): ArrayBuffer
fun readAsBinaryString(blob: Blob): String
fun readAsText(blob: Blob, label: String = definedExternally): String
fun readAsDataURL(blob: Blob): String
}