From d16334280def1db291bc1c810d05b9f164043be8 Mon Sep 17 00:00:00 2001 From: Roy Bregman Date: Thu, 5 Dec 2019 20:07:00 +0200 Subject: [PATCH] fixing flow errors --- src/flash.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/flash.js b/src/flash.js index 9aaef7b..28860af 100644 --- a/src/flash.js +++ b/src/flash.js @@ -45,14 +45,14 @@ class Flash extends FakeEventTarget implements IEngine { * @type {Object} * @private */ - _config: Object = null; + _config: ?Object = null; /** * Promise when load finished * @type {Promise<*>} * @private */ - _loadPromise: Promise<*> = null; + _loadPromise: ?Promise<*> = null; /** * volume value @@ -420,11 +420,13 @@ class Flash extends FakeEventTarget implements IEngine { * @returns {void} */ play(): void { - this._loadPromise.then(() => { - if (this._api) { - this._api.play(); - } - }); + if (this._loadPromise) { + this._loadPromise.then(() => { + if (this._api) { + this._api.play(); + } + }); + } } pause(): void { @@ -800,7 +802,7 @@ class Flash extends FakeEventTarget implements IEngine { * @returns {boolean} - Whether the video tag has an attribute of playsinline. */ get playsinline(): boolean { - return this._config.playsinline; + return this._config ? this._config.playsinline : false; } /**