clang-format core/workspace_audio.js

This commit is contained in:
kozbial
2021-07-26 14:50:13 -07:00
committed by Monica Kozbial
parent 5f819cd0fe
commit 813f27706f

View File

@@ -28,7 +28,6 @@ const userAgent = goog.require('Blockly.utils.userAgent');
* @constructor
*/
const WorkspaceAudio = function(parentWorkspace) {
/**
* The parent of the workspace this object belongs to, or null. May be
* checked for sounds that this object can't find.
@@ -105,9 +104,10 @@ WorkspaceAudio.prototype.preload = function() {
const playPromise = sound.play();
// Edge does not return a promise, so we need to check.
if (playPromise !== undefined) {
// If we don't wait for the play request to complete before calling pause()
// we will get an exception: (DOMException: The play() request was interrupted)
// See more: https://developers.google.com/web/updates/2017/06/play-request-was-interrupted
// If we don't wait for the play request to complete before calling
// pause() we will get an exception: (DOMException: The play() request was
// interrupted) See more:
// https://developers.google.com/web/updates/2017/06/play-request-was-interrupted
playPromise.then(sound.pause).catch(function() {
// Play without user interaction was prevented.
});