File tree 2 files changed +4
-9
lines changed
Sources/DOMKit/ECMAScript
2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import JavaScriptKit
6
6
7
- public class Global {
8
- public let jsObject = JSObject . global
9
- public let document : Document
10
-
11
- init ( ) {
12
- document = Document ( unsafelyWrapping: jsObject. document. object!)
13
- }
7
+ public extension Window {
8
+ public var document : Document { Document ( unsafelyWrapping: jsObject. document. object!) }
14
9
}
15
10
16
11
public extension Document {
@@ -25,7 +20,7 @@ public extension HTMLElement {
25
20
}
26
21
}
27
22
28
- public let global = Global ( )
23
+ public let globalThis = Window ( from : JSObject . global . jsValue ( ) ) !
29
24
30
25
public class ReadableStream : JSBridgedClass {
31
26
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import DOMKit
3
3
4
4
final class DOMKitTests : XCTestCase {
5
5
func testExample( ) {
6
- let document = global . document
6
+ let document = globalThis . document
7
7
let button = document. createElement ( localName: " button " )
8
8
button. textContent = " Hello, world! "
9
9
button. addEventListener ( type: " click " ) { event in
You can’t perform that action at this time.
0 commit comments