diff options
Diffstat (limited to 'src/client/Utils.hx')
| -rw-r--r-- | src/client/Utils.hx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/Utils.hx b/src/client/Utils.hx index a120166..9217e07 100644 --- a/src/client/Utils.hx +++ b/src/client/Utils.hx @@ -7,6 +7,7 @@ import js.Browser.window; import js.html.Element; import js.html.FileReader; import js.html.URL; +import js.html.audio.AudioContext; import js.lib.ArrayBuffer; class Utils { @@ -205,4 +206,10 @@ class Utils { final observer = (window : Dynamic).ResizeObserver ?? return null; return js.Syntax.code("new ResizeObserver({0})", callback); } + + public static function createAudioContext():Null<AudioContext> { + final w:Dynamic = js.Browser.window; + final ctx = w.AudioContext ?? w.webkitAudioContext ?? return null; + return js.Syntax.code("new {0}()", ctx); + } } |
