diff --git a/.gitignore b/.gitignore index 5c5c736..9a7207a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ node_modules .idea .vscode .history - +coverage/lcov-report/ dist/ diff --git a/package.json b/package.json index 585463c..304d019 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lottiefiles/lottie-player", - "version": "1.6.0", + "version": "1.6.1", "description": "Lottie animation and Telegram Sticker player web components.", "main": "dist/lottie-player.js", "module": "dist/lottie-player.esm.js", diff --git a/src/lottie-player.ts b/src/lottie-player.ts index 1fa426e..e8025f1 100644 --- a/src/lottie-player.ts +++ b/src/lottie-player.ts @@ -140,6 +140,12 @@ export class LottiePlayer extends LitElement { @property({ type: Number }) public direction: number = 1; + /** + * Disable checking if the Lottie is valid before loading + */ + @property({ type: Boolean }) + public disableCheck?: boolean = false; + /** * Whether to play on mouse hover */ @@ -262,17 +268,19 @@ export class LottiePlayer extends LitElement { // Attach the event listeners before we check the requested json file for errors this._attachEventListeners(); - // Fetch resource if src is a remote URL - if (srcAttrib === "path") { - jsonData = await fromURL(srcParsed as string); - srcAttrib = "animationData"; - } else { - jsonData = srcParsed; - } + if (!this.disableCheck) { + // Fetch resource if src is a remote URL + if (srcAttrib === "path") { + jsonData = await fromURL(srcParsed as string); + srcAttrib = "animationData"; + } else { + jsonData = srcParsed; + } - if (!isLottie(jsonData)) { - this.currentState = PlayerState.Error; - this.dispatchEvent(new CustomEvent(PlayerEvents.Error)); + if (!isLottie(jsonData)) { + this.currentState = PlayerState.Error; + this.dispatchEvent(new CustomEvent(PlayerEvents.Error)); + } } } catch (err) { this.currentState = PlayerState.Error;