Skip to content

Conversation

@toastal
Copy link
Contributor

@toastal toastal commented Jun 21, 2020

Borrowing the create and create' from HTMLImageElement, Audio exists much in the same way.

@toastal toastal force-pushed the create-audio branch 2 times, most recently from 55946fe to e030606 Compare June 21, 2020 08:27
Copy link
Contributor

@JordanMartinez JordanMartinez left a 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.

toEventTarget :: HTMLAudioElement -> EventTarget
toEventTarget = unsafeCoerce

foreign import create :: Unit -> Effect HTMLAudioElement
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor

@thomashoneyman thomashoneyman Dec 12, 2020

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. 🤷‍♀️

Copy link
Contributor

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.

Copy link
Member

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 🤔

@JordanMartinez JordanMartinez merged commit ef295db into purescript-web:master Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants