Skip to content

Commit 55946fe

Browse files
committed
create new Audio
1 parent 5a19c76 commit 55946fe

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

src/Web/HTML/HTMLAudioElement.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* global Audio */
2+
"use strict";
3+
4+
exports.create = function () {
5+
return function () {
6+
return new Audio();
7+
};
8+
};
9+
10+
exports.createWithURL = function (url) {
11+
return function () {
12+
return new Audio(url);
13+
};
14+
};

src/Web/HTML/HTMLAudioElement.purs

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
module Web.HTML.HTMLAudioElement where
1+
module Web.HTML.HTMLAudioElement
2+
( HTMLAudioElement
3+
, fromHTMLElement
4+
, fromElement
5+
, fromNode
6+
, fromChildNode
7+
, fromNonDocumentTypeChildNode
8+
, fromParentNode
9+
, fromEventTarget
10+
, toHTMLMediaElement
11+
, toHTMLElement
12+
, toElement
13+
, toNode
14+
, toChildNode
15+
, toNonDocumentTypeChildNode
16+
, toParentNode
17+
, toEventTarget
18+
, create
19+
, create'
20+
) where
221

322
import Data.Maybe (Maybe)
423
import Unsafe.Coerce (unsafeCoerce)
@@ -57,3 +76,9 @@ toParentNode = unsafeCoerce
5776

5877
toEventTarget :: HTMLAudioElement -> EventTarget
5978
toEventTarget = unsafeCoerce
79+
80+
foreign import create :: Unit -> Effect HTMLAudioElement
81+
foreign import createWithURL :: String -> Effect HTMLAudioElement
82+
83+
create' :: String Effect HTMLAudioElement
84+
create' = createWithURL

0 commit comments

Comments
 (0)