-
Notifications
You must be signed in to change notification settings - Fork 24
create new Audio #32
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
create new Audio #32
Conversation
55946fe
to
e030606
Compare
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.
Waiting for your response on the below question. I believe the extra Unit ->
isn't necessary. If so, you'll need to update the FFI.
@@ -57,3 +78,9 @@ toParentNode = unsafeCoerce | |||
|
|||
toEventTarget :: HTMLAudioElement -> EventTarget | |||
toEventTarget = unsafeCoerce | |||
|
|||
foreign import create :: Unit -> Effect HTMLAudioElement |
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.
Why isn't this just create :: Effect HTMLAudioElement
? Why the extra Unit ->
arg?
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.
You're correct that the Unit isn't necessary, but @toastal is following the existing pattern from the bindings from HTMLImageElement.
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.
That's why I accepted it here, though the Unit
is unnecessary. @hdgarrood would you also be open to fixing these functions so that they're just in Effect
right now?
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.
Ah... That makes more sense. Why were they originally Unit -> Effect result
?
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.
Now that I don't know. 🤷♀️
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.
I would be open to that, yes. I also don’t know why they’re like this. I generally haven’t been very involved with the web libraries, actually.
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.
Ah... That makes more sense. Why were they originally
Unit -> Effect result
?
'tis a mystery to me also, even though I'm probably the one who did it 🤔
Borrowing the
create
andcreate'
fromHTMLImageElement
,Audio
exists much in the same way.