Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to JavaScriptKit 0.9, add Global helpers #3

Merged
merged 2 commits into from Dec 27, 2020

Conversation

MaxDesiatov
Copy link
Contributor

Updates JavaScriptKit dependency to upstream 0.9 instead of using a fork as previously. I've updated a few helpers to use non-deprecated names and also added Global type and public let global = Global() with a few extensions on DOM types which for some reason don't seem to be declared in WebIDL.

Additional DOMKitDemo target and product are set up for easy manual test.

@MaxDesiatov MaxDesiatov added enhancement New feature or request dependencies Updates to the project dependencies labels Dec 26, 2020
@MaxDesiatov MaxDesiatov requested a review from a team December 26, 2020 19:00
Sources/DOMKit/ECMAScript/Support.swift Outdated Show resolved Hide resolved
return jsObject.text!().fromJSValue()!
}

public func arrayBuffer() -> Promise<ArrayBuffer> {
public func arrayBuffer() -> JSPromise<ArrayBuffer, JSError> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this change in webidl2swift and re-run it to regenerate these files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can fix this in webidl2swift, but I'm not sure if we can rely on it long-term. It's great to provide initial scaffolding, but there's also some generated junk to clean up and manual handling of JSClosure is still required. I've done some of that manual work in #4.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webidl2swift changes are now available for review in Apodini/webidl2swift#10.

Comment on lines +16 to +20
public extension Document {
var body: HTMLElement {
.init(unsafelyWrapping: jsObject.body.object!)
}
}
Copy link
Member

@j-f1 j-f1 Dec 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is defined as a property on the Document object by the spec (https://html.spec.whatwg.org/#the-document-object:dom-document-body) but the dom.webidl doesn’t reference it so it isn’t properly generated. I mentioned parsing the HTML spec as a stumbling block earlier but may give it a go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Conflicts:
#	Tests/DOMKitTests/DOMKitTests.swift
@MaxDesiatov MaxDesiatov merged commit 44d49bc into main Dec 27, 2020
@MaxDesiatov MaxDesiatov deleted the update-dependencies branch December 27, 2020 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Updates to the project dependencies enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants