forked from swiftwasm/JavaScriptKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobalThisImports.swift
More file actions
105 lines (96 loc) · 3.66 KB
/
Copy pathGlobalThisImports.swift
File metadata and controls
105 lines (96 loc) · 3.66 KB
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
#if arch(wasm32)
@_extern(wasm, module: "TestModule", name: "bjs_console_get")
fileprivate func bjs_console_get_extern() -> Int32
#else
fileprivate func bjs_console_get_extern() -> Int32 {
fatalError("Only available on WebAssembly")
}
#endif
@inline(never) fileprivate func bjs_console_get() -> Int32 {
return bjs_console_get_extern()
}
func _$console_get() throws(JSException) -> JSConsole {
let ret = bjs_console_get()
if let error = _swift_js_take_exception() {
throw error
}
return JSConsole.bridgeJSLiftReturn(ret)
}
#if arch(wasm32)
@_extern(wasm, module: "TestModule", name: "bjs_parseInt")
fileprivate func bjs_parseInt_extern(_ stringBytes: Int32, _ stringLength: Int32) -> Float64
#else
fileprivate func bjs_parseInt_extern(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 {
fatalError("Only available on WebAssembly")
}
#endif
@inline(never) fileprivate func bjs_parseInt(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 {
return bjs_parseInt_extern(stringBytes, stringLength)
}
func _$parseInt(_ string: String) throws(JSException) -> Double {
let ret = _swift_js_with_borrowed_utf8(string) { stringBytes, stringLength in
bjs_parseInt(stringBytes, stringLength)
}
if let error = _swift_js_take_exception() {
throw error
}
return Double.bridgeJSLiftReturn(ret)
}
#if arch(wasm32)
@_extern(wasm, module: "TestModule", name: "bjs_JSConsole_log")
fileprivate func bjs_JSConsole_log_extern(_ self: Int32, _ messageBytes: Int32, _ messageLength: Int32) -> Void
#else
fileprivate func bjs_JSConsole_log_extern(_ self: Int32, _ messageBytes: Int32, _ messageLength: Int32) -> Void {
fatalError("Only available on WebAssembly")
}
#endif
@inline(never) fileprivate func bjs_JSConsole_log(_ self: Int32, _ messageBytes: Int32, _ messageLength: Int32) -> Void {
return bjs_JSConsole_log_extern(self, messageBytes, messageLength)
}
func _$JSConsole_log(_ self: JSObject, _ message: String) throws(JSException) -> Void {
let selfValue = self.bridgeJSLowerParameter()
_swift_js_with_borrowed_utf8(message) { messageBytes, messageLength in
bjs_JSConsole_log(selfValue, messageBytes, messageLength)
}
if let error = _swift_js_take_exception() {
throw error
}
}
#if arch(wasm32)
@_extern(wasm, module: "TestModule", name: "bjs_WebSocket_init")
fileprivate func bjs_WebSocket_init_extern(_ urlBytes: Int32, _ urlLength: Int32) -> Int32
#else
fileprivate func bjs_WebSocket_init_extern(_ urlBytes: Int32, _ urlLength: Int32) -> Int32 {
fatalError("Only available on WebAssembly")
}
#endif
@inline(never) fileprivate func bjs_WebSocket_init(_ urlBytes: Int32, _ urlLength: Int32) -> Int32 {
return bjs_WebSocket_init_extern(urlBytes, urlLength)
}
#if arch(wasm32)
@_extern(wasm, module: "TestModule", name: "bjs_WebSocket_close")
fileprivate func bjs_WebSocket_close_extern(_ self: Int32) -> Void
#else
fileprivate func bjs_WebSocket_close_extern(_ self: Int32) -> Void {
fatalError("Only available on WebAssembly")
}
#endif
@inline(never) fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void {
return bjs_WebSocket_close_extern(self)
}
func _$WebSocket_init(_ url: String) throws(JSException) -> JSObject {
let ret = _swift_js_with_borrowed_utf8(url) { urlBytes, urlLength in
bjs_WebSocket_init(urlBytes, urlLength)
}
if let error = _swift_js_take_exception() {
throw error
}
return JSObject.bridgeJSLiftReturn(ret)
}
func _$WebSocket_close(_ self: JSObject) throws(JSException) -> Void {
let selfValue = self.bridgeJSLowerParameter()
bjs_WebSocket_close(selfValue)
if let error = _swift_js_take_exception() {
throw error
}
}