refactor: Remove nested Promise

This commit is contained in:
Dmitry Lyzo 2022-02-26 13:56:50 +03:00
parent 270430f6a1
commit bde869ecb2

View File

@ -39,16 +39,12 @@ class PlaybackPermissionManager {
return Promise.resolve(true); return Promise.resolve(true);
} }
return new Promise((resolve, reject) => { const media = createTestMediaElement();
const media = createTestMediaElement();
media.play().then(() => { return media.play()
resolve(); .finally(() => {
}).catch((error) => {
reject(error);
}).finally(() => {
destroyTestMediaElement(media); destroyTestMediaElement(media);
}); });
});
} }
} }