mirror of
https://github.com/google/blockly.git
synced 2026-01-11 10:57:07 +01:00
clang-format core/workspace_audio.js
This commit is contained in:
@@ -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.
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user