-
Notifications
You must be signed in to change notification settings - Fork 8
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,11 +50,11 @@ public class Blob: JSBridgedClass { | |
return jsObject.stream!().fromJSValue()! | ||
} | ||
|
||
public func text() -> Promise<String> { | ||
public func text() -> JSPromise<String, JSError> { | ||
return jsObject.text!().fromJSValue()! | ||
} | ||
|
||
public func arrayBuffer() -> Promise<ArrayBuffer> { | ||
public func arrayBuffer() -> JSPromise<ArrayBuffer, JSError> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make this change in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can fix this in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return jsObject.arrayBuffer!().fromJSValue()! | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import JavaScriptKit | ||
import DOMKit | ||
|
||
let document = global.document | ||
|
||
let header = HTMLElement(from: document.createElement(localName: "h1"))! | ||
header.innerText = "Hello World!" | ||
_ = document.body.appendChild(node: header) | ||
|
||
console.log(data: "Hello, world!") |
There was a problem hiding this comment.
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 thedom.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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏩ Apodini/webidl2swift#11